module documentation

Base SQL and DDL compiler implementations.

Classes provided include:

.compiler.SQLCompiler - renders SQL strings

.compiler.DDLCompiler - renders DDL (data definition language) strings

.compiler.GenericTypeCompiler - renders type specification strings.

To generate user-defined SQL strings, see :doc:`/ext/compiler`.

Class ​Compiled Represent a compiled SQL or DDL expression.
Class ​DDLCompiler No class docstring; 0/2 property, 1/38 method documented
Class ​Generic​Type​Compiler Undocumented
Class ​Identifier​Preparer Handle quoting and case-folding of identifiers based on options.
Class ​SQLCompiler Default implementation of .Compiled.
Class ​Str​SQLCompiler A .SQLCompiler subclass which allows a small selection of non-standard SQL features to render into a string value.
Constant BIND​_PARAMS Undocumented
Constant BIND​_PARAMS​_ESC Undocumented
Constant BIND​_TEMPLATES Undocumented
Constant COLLECT​_CARTESIAN​_PRODUCTS Undocumented
Constant COMPOUND​_KEYWORDS Undocumented
Constant EXTRACT​_MAP Undocumented
Constant FK​_INITIALLY Undocumented
Constant FK​_ON​_DELETE Undocumented
Constant FK​_ON​_UPDATE Undocumented
Constant FROM​_LINTING Undocumented
Constant FUNCTIONS Undocumented
Constant ILLEGAL​_INITIAL​_CHARACTERS Undocumented
Constant LEGAL​_CHARACTERS Undocumented
Constant LEGAL​_CHARACTERS​_PLUS​_SPACE Undocumented
Constant NO​_LINTING Undocumented
Constant OPERATORS Undocumented
Constant RESERVED​_WORDS Undocumented
Constant RM​_NAME Undocumented
Constant RM​_OBJECTS Undocumented
Constant RM​_RENDERED​_NAME Undocumented
Constant RM​_TYPE Undocumented
Constant WARN​_LINTING Undocumented
Variable ​Expanded​State Undocumented
Class _​Compile​Label lightweight label object which acts as an expression.Label.
Class ​From​Linter Undocumented
Class ​Str​SQLType​Compiler Undocumented
Class ​Type​Compiler Produces DDL specification for TypeEngine objects.
Constant ​_BIND​_TRANSLATE​_CHARS Undocumented
Constant ​_BIND​_TRANSLATE​_RE Undocumented
BIND_PARAMS =

Undocumented

Value
re.compile(r'(?<![:\w\$\\]):([\w\$]+)(?![:\w\$])',
           re.UNICODE)
BIND_PARAMS_ESC =

Undocumented

Value
re.compile(r'\\(:[\w\$]*)(?![:\w\$])',
           re.UNICODE)
BIND_TEMPLATES: dict[str, str] =

Undocumented

Value
{'pyformat': '%%(%(name)s)s',
 'qmark': '?',
 'format': '%%s',
 'numeric': ':[_POSITION]',
 'named': ':%(name)s'}
COLLECT_CARTESIAN_PRODUCTS =

Undocumented

Value
util.symbol('COLLECT_CARTESIAN_PRODUCTS',
            'Collect data on FROMs and cartesian products and gather into \'self
.from_linter\'',
            canonical=1)
EXTRACT_MAP: dict[str, str] =

Undocumented

Value
{'month': 'month',
 'day': 'day',
 'year': 'year',
 'second': 'second',
 'hour': 'hour',
 'doy': 'doy',
 'minute': 'minute',
...
FK_INITIALLY =

Undocumented

Value
re.compile(r'^(?:DEFERRED|IMMEDIATE)$',
           re.I)
FK_ON_DELETE =

Undocumented

Value
re.compile(r'^(?:RESTRICT|CASCADE|SET NULL|NO ACTION|SET DEFAULT)$',
           re.I)
FK_ON_UPDATE =

Undocumented

Value
re.compile(r'^(?:RESTRICT|CASCADE|SET NULL|NO ACTION|SET DEFAULT)$',
           re.I)
FROM_LINTING =

Undocumented

Value
util.symbol('FROM_LINTING',
            'Warn for cartesian products; combines COLLECT_CARTESIAN_PRODUCTS an
d WARN_LINTING',
            canonical=COLLECT_CARTESIAN_PRODUCTS|WARN_LINTING)
FUNCTIONS =

Undocumented

Value
{functions.coalesce: 'coalesce',
 functions.current_date: 'CURRENT_DATE',
 functions.current_time: 'CURRENT_TIME',
 functions.current_timestamp: 'CURRENT_TIMESTAMP',
 functions.current_user: 'CURRENT_USER',
 functions.localtime: 'LOCALTIME',
 functions.localtimestamp: 'LOCALTIMESTAMP',
...
ILLEGAL_INITIAL_CHARACTERS =

Undocumented

Value
{str(x) for x in range(0, 10)}.union(['$'])
LEGAL_CHARACTERS =

Undocumented

Value
re.compile(r'^[A-Z0-9_\$]+$',
           re.I)
LEGAL_CHARACTERS_PLUS_SPACE =

Undocumented

Value
re.compile(r'^[A-Z0-9_ \$]+$',
           re.I)
NO_LINTING =

Undocumented

Value
util.symbol('NO_LINTING', 'Disable all linting.',
            canonical=0)
OPERATORS =

Undocumented

Value
{operators.and_: ' AND ',
 operators.or_: ' OR ',
 operators.add: ' + ',
 operators.mul: ' * ',
 operators.sub: ' - ',
 operators.div: ' / ',
 operators.mod: ' % ',
...
RESERVED_WORDS =

Undocumented

Value
set(['all',
     'analyse',
     'analyze',
     'and',
     'any',
     'array',
     'as',
...
RM_NAME: int =

Undocumented

Value
1
RM_OBJECTS: int =

Undocumented

Value
2
RM_RENDERED_NAME: int =

Undocumented

Value
0
RM_TYPE: int =

Undocumented

Value
3
WARN_LINTING =

Undocumented

Value
util.symbol('WARN_LINTING', 'Emit warnings for linters that find problems',
            canonical=2)
ExpandedState =

Undocumented

_BIND_TRANSLATE_CHARS =

Undocumented

Value
dict(zip('%():[]', 'PAZC__'))
_BIND_TRANSLATE_RE =

Undocumented

Value
re.compile(r'[%\(\):\[\]]')