GitHub

Compiler

API reference for Compiler.

Compiles fragments for dialect. Results are cached per fragment (and per without_transform).

Attributes

AttributeTypeDescription
dialectDialect
optionsCompilerOptions
without_transformCompiler

This compiler, never renaming identifiers.

Functions

__init__

__init__(options, *, disable_transforms=False, caches=None) -> None
ParameterTypeDescription
optionsCompilerOptions
disable_transformsbool = False
cachestuple[WeakKeyDictionary[Fragment, Compiled], WeakKeyDictionary[Fragment, Compiled]] | None = None
def __init__(
    self,
    options: CompilerOptions,
    *,
    disable_transforms: bool = False,
    caches: tuple[WeakKeyDictionary[Fragment, Compiled], WeakKeyDictionary[Fragment, Compiled]]
    | None = None,
) -> None:
    self._options = options
    self._disable_transforms = disable_transforms
    self._cache, self._cache_no_transform = caches or (WeakKeyDictionary(), WeakKeyDictionary())

compile

compile(statement, without_transform=False) -> Compiled

statement's SQL and parameters; without_transform keeps identifiers as they are.

ParameterTypeDescription
statementFragment
without_transformbool = False

Returns Compiled

def compile(self, statement: Fragment, without_transform: bool = False) -> Compiled:
    """``statement``'s SQL and parameters; ``without_transform`` keeps
    identifiers as they are."""
    return self._compile(statement, without_transform, None)