module documentation

Undocumented

Class AnalyzedCode No class docstring; 0/5 instance variable, 0/3 class variable, 5/11 methods, 0/2 class method documented
Class AnalyzedFunction No class docstring; 0/9 instance variable, 0/2 class variable, 2/4 methods documented
Class DeferredLambdaElement A LambdaElement where the lambda accepts arguments and is invoked within the compile phase with special context.
Class LambdaElement A SQL construct where the state is stored as an un-invoked lambda.
Class LambdaOptions Undocumented
Class LinkedLambdaElement Represent subsequent links of a :class:`.StatementLambdaElement`.
Class NonAnalyzedFunction Undocumented
Class NullLambdaStatement Provides the :class:`.StatementLambdaElement` API but does not cache or analyze lambdas.
Class PyWrapper A wrapper object that is injected into the ``__globals__`` and ``__closure__`` of a Python function.
Class StatementLambdaElement Represent a composable SQL statement as a :class:`_sql.LambdaElement`.
Function insp Undocumented
Function lambda_stmt Produce a SQL statement that is cached as a lambda.
Type Variable _E Undocumented
Type Alias _AnyLambdaType Undocumented
Type Alias _BoundParameterGetter Undocumented
Type Alias _LambdaCacheType Undocumented
Type Alias _LambdaType Undocumented
Type Alias _StmtLambdaElementType Undocumented
Type Alias _StmtLambdaType Undocumented
Variable _closure_per_cache_key Undocumented
def lambda_stmt(lmb: _StmtLambdaType, enable_tracking: bool = True, track_closure_variables: bool = True, track_on: Optional[object] = None, global_track_bound_values: bool = True, track_bound_values: bool = True, lambda_cache: Optional[_LambdaCacheType] = None) -> StatementLambdaElement: (source)

Produce a SQL statement that is cached as a lambda. The Python code object within the lambda is scanned for both Python literals that will become bound parameters as well as closure variables that refer to Core or ORM constructs that may vary. The lambda itself will be invoked only once per particular set of constructs detected. E.g.:: from sqlalchemy import lambda_stmt stmt = lambda_stmt(lambda: table.select()) stmt += lambda s: s.where(table.c.id == 5) result = connection.execute(stmt) The object returned is an instance of :class:`_sql.StatementLambdaElement`. .. versionadded:: 1.4 :param lmb: a Python function, typically a lambda, which takes no arguments and returns a SQL expression construct :param enable_tracking: when False, all scanning of the given lambda for changes in closure variables or bound parameters is disabled. Use for a lambda that produces the identical results in all cases with no parameterization. :param track_closure_variables: when False, changes in closure variables within the lambda will not be scanned. Use for a lambda where the state of its closure variables will never change the SQL structure returned by the lambda. :param track_bound_values: when False, bound parameter tracking will be disabled for the given lambda. Use for a lambda that either does not produce any bound values, or where the initial bound values never change. :param global_track_bound_values: when False, bound parameter tracking will be disabled for the entire statement including additional links added via the :meth:`_sql.StatementLambdaElement.add_criteria` method. :param lambda_cache: a dictionary or other mapping-like object where information about the lambda's Python code as well as the tracked closure variables in the lambda itself will be stored. Defaults to a global LRU cache. This cache is independent of the "compiled_cache" used by the :class:`_engine.Connection` object. .. seealso:: :ref:`engine_lambda_caching`

Undocumented

Value
TypeVar('_E',
        bound=Executable)
_AnyLambdaType = (source)

Undocumented

Value
Callable[..., Any]
_BoundParameterGetter = (source)

Undocumented

Value
Callable[..., Any]
_LambdaCacheType = (source)

Undocumented

Value
MutableMapping[Tuple[Any, ...], Union['NonAnalyzedFunction', 'AnalyzedFunction']
]
_LambdaType = (source)

Undocumented

Value
Callable[[], Any]
_StmtLambdaElementType = (source)

Undocumented

Value
Callable[[_E], Any]
_StmtLambdaType = (source)

Undocumented

Value
Callable[[], Any]
_closure_per_cache_key: _LambdaCacheType = (source)

Undocumented