Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Module « sqlalchemy »

Fonction lambda_stmt - module sqlalchemy

Signature de la fonction lambda_stmt

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' 

Description

help(sqlalchemy.lambda_stmt)

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`




Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé