Compiles fragments for dialect. Results are cached per fragment
(and per without_transform).
Attributes#
| Attribute | Type | Description |
|---|---|---|
dialect | Dialect | |
options | CompilerOptions | |
without_transform | Compiler | This compiler, never renaming identifiers. |
Functions#
__init__#
__init__(options, *, disable_transforms=False, caches=None) -> None| Parameter | Type | Description |
|---|---|---|
options | CompilerOptions | |
disable_transforms | bool = False | |
caches | tuple[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) -> Compiledstatement's SQL and parameters; without_transform keeps
identifiers as they are.
| Parameter | Type | Description |
|---|---|---|
statement | Fragment | |
without_transform | bool = 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)