class ExecutionContext: (source)
Known subclasses: sqlalchemy.engine.default.DefaultExecutionContext
A messenger object for a Dialect that corresponds to a single execution.
Method | create |
Return a new cursor generated from this ExecutionContext's connection. |
Method | fire |
given a :class:`.Sequence`, invoke it and return the next int value |
Method | get |
Return a sequence of OUT parameter values from a cursor. |
Method | get |
Return the DBAPI ``cursor.rowcount`` value, or in some cases an interpreted value. |
Method | handle |
Receive a DBAPI exception which occurred upon execute, result fetch, etc. |
Method | lastrow |
Return True if the last INSERT or UPDATE row contained inlined or database-side defaults. |
Method | post |
Called after the execution of a compiled statement. |
Method | pre |
Called before an execution of a compiled statement. |
Class Variable | compiled |
if passed to constructor, sqlalchemy.engine.base.Compiled object being executed |
Class Variable | connection |
Connection object which can be freely used by default value generators to execute SQL. This Connection should reference the same underlying connection/transactional resources of root_connection. |
Class Variable | cursor |
DB-API cursor procured from the connection |
Class Variable | dialect |
dialect which created this ExecutionContext. |
Class Variable | engine |
engine which the Connection is associated with |
Class Variable | execute |
the style of DBAPI cursor method that will be used to execute a statement. |
Class Variable | executemany |
True if the context has a list of more than one parameter set. |
Class Variable | invoked |
The Executable statement object that was given in the first place. |
Class Variable | isinsert |
True if the statement is an INSERT. |
Class Variable | isupdate |
True if the statement is an UPDATE. |
Class Variable | no |
True if the execution style does not use parameters |
Class Variable | parameters |
bind parameters passed to the execute() or exec_driver_sql() methods. |
Class Variable | postfetch |
a list of Column objects for which a server-side default or inline SQL expression value was fired off. Applies to inserts and updates. |
Class Variable | prefetch |
a list of Column objects for which a client-side default was fired off. Applies to inserts and updates. |
Class Variable | root |
Connection object which is the source of this ExecutionContext. |
Class Variable | statement |
string version of the statement to be executed. Is either passed to the constructor, or must be created from the sql.Compiled object by the time pre_exec() has completed. |
Class Method | _init |
Undocumented |
Class Method | _init |
Undocumented |
Class Method | _init |
Undocumented |
Class Method | _init |
Undocumented |
Method | _exec |
Undocumented |
Method | _get |
Undocumented |
Method | _prepare |
Undocumented |
Method | _setup |
Undocumented |
sqlalchemy.engine.default.DefaultExecutionContext
Return a new cursor generated from this ExecutionContext's connection. Some dialects may wish to change the behavior of connection.cursor(), such as postgresql which may return a PG "server side" cursor.
sqlalchemy.dialects.mssql.base.MSExecutionContext
, sqlalchemy.dialects.mysql.base.MySQLExecutionContext
, sqlalchemy.dialects.oracle.base.OracleExecutionContext
, sqlalchemy.dialects.postgresql.base.PGExecutionContext
given a :class:`.Sequence`, invoke it and return the next int value
sqlalchemy.engine.default.DefaultExecutionContext
Return a sequence of OUT parameter values from a cursor. For dialects that support OUT parameters, this method will be called when there is a :class:`.SQLCompiler` object which has the :attr:`.SQLCompiler.has_out_parameters` flag set. This flag in turn will be set to True if the statement itself has :class:`.BindParameter` objects that have the ``.isoutparam`` flag set which are consumed by the :meth:`.SQLCompiler.visit_bindparam` method. If the dialect compiler produces :class:`.BindParameter` objects with ``.isoutparam`` set which are not handled by :meth:`.SQLCompiler.visit_bindparam`, it should set this flag explicitly. The list of names that were rendered for each bound parameter is passed to the method. The method should then return a sequence of values corresponding to the list of parameter objects. Unlike in previous SQLAlchemy versions, the values can be the **raw values** from the DBAPI; the execution context will apply the appropriate type handler based on what's present in self.compiled.binds and update the values. The processed dictionary will then be made available via the ``.out_parameters`` collection on the result object. Note that SQLAlchemy 1.4 has multiple kinds of result object as part of the 2.0 transition. .. versionadded:: 1.4 - added :meth:`.ExecutionContext.get_out_parameter_values`, which is invoked automatically by the :class:`.DefaultExecutionContext` when there are :class:`.BindParameter` objects with the ``.isoutparam`` flag set. This replaces the practice of setting out parameters within the now-removed ``get_result_proxy()`` method.
Return the DBAPI ``cursor.rowcount`` value, or in some cases an interpreted value. See :attr:`_engine.CursorResult.rowcount` for details on this.
sqlalchemy.engine.default.DefaultExecutionContext
Receive a DBAPI exception which occurred upon execute, result fetch, etc.
sqlalchemy.engine.default.DefaultExecutionContext
Return True if the last INSERT or UPDATE row contained inlined or database-side defaults.
sqlalchemy.engine.default.DefaultExecutionContext
Called after the execution of a compiled statement. If a compiled statement was passed to this ExecutionContext, the `last_insert_ids`, `last_inserted_params`, etc. datamembers should be available after this method completes.
sqlalchemy.engine.default.DefaultExecutionContext
Called before an execution of a compiled statement. If a compiled statement was passed to this ExecutionContext, the `statement` and `parameters` datamembers must be initialized after this statement is complete.
sqlalchemy.engine.default.DefaultExecutionContext
if passed to constructor, sqlalchemy.engine.base.Compiled object being executed
sqlalchemy.engine.default.DefaultExecutionContext
Connection object which can be freely used by default value generators to execute SQL. This Connection should reference the same underlying connection/transactional resources of root_connection.
sqlalchemy.engine.default.DefaultExecutionContext
DB-API cursor procured from the connection
sqlalchemy.engine.default.DefaultExecutionContext
dialect which created this ExecutionContext.
sqlalchemy.engine.default.DefaultExecutionContext
engine which the Connection is associated with
sqlalchemy.engine.default.DefaultExecutionContext
the style of DBAPI cursor method that will be used to execute a statement. .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultExecutionContext
True if the context has a list of more than one parameter set. Historically this attribute links to whether ``cursor.execute()`` or ``cursor.executemany()`` will be used. It also can now mean that "insertmanyvalues" may be used which indicates one or more ``cursor.execute()`` calls.
sqlalchemy.engine.default.DefaultExecutionContext
The Executable statement object that was given in the first place. This should be structurally equivalent to compiled.statement, but not necessarily the same object as in a caching scenario the compiled form will have been extracted from the cache.
sqlalchemy.engine.default.DefaultExecutionContext
True if the execution style does not use parameters
sqlalchemy.engine.default.DefaultExecutionContext
bind parameters passed to the execute() or exec_driver_sql() methods. These are always stored as a list of parameter entries. A single-element list corresponds to a ``cursor.execute()`` call and a multiple-element list corresponds to ``cursor.executemany()``, except in the case of :attr:`.ExecuteStyle.INSERTMANYVALUES` which will use ``cursor.execute()`` one or more times.
sqlalchemy.engine.default.DefaultExecutionContext
a list of Column objects for which a server-side default or inline SQL expression value was fired off. Applies to inserts and updates.
sqlalchemy.engine.default.DefaultExecutionContext
a list of Column objects for which a client-side default was fired off. Applies to inserts and updates.
sqlalchemy.engine.default.DefaultExecutionContext
Connection object which is the source of this ExecutionContext.
sqlalchemy.engine.default.DefaultExecutionContext
string version of the statement to be executed. Is either passed to the constructor, or must be created from the sql.Compiled object by the time pre_exec() has completed.
def _init_compiled(cls, dialect:
Dialect
, connection: Connection
, dbapi_connection: PoolProxiedConnection
, execution_options: _ExecuteOptions
, compiled: SQLCompiler
, parameters: _CoreMultiExecuteParams
, invoked_statement: Executable
, extracted_parameters: Optional[ Sequence[ BindParameter[ Any]]]
, cache_hit: CacheStats
= CacheStats.CACHING_DISABLED) -> ExecutionContext
:
(source)
¶
sqlalchemy.engine.default.DefaultExecutionContext
Undocumented
def _init_ddl(cls, dialect:
Dialect
, connection: Connection
, dbapi_connection: PoolProxiedConnection
, execution_options: _ExecuteOptions
, compiled_ddl: DDLCompiler
) -> ExecutionContext
:
(source)
¶
sqlalchemy.engine.default.DefaultExecutionContext
Undocumented
def _init_default(cls, dialect:
Dialect
, connection: Connection
, dbapi_connection: PoolProxiedConnection
, execution_options: _ExecuteOptions
) -> ExecutionContext
:
(source)
¶
sqlalchemy.engine.default.DefaultExecutionContext
Undocumented
def _init_statement(cls, dialect:
Dialect
, connection: Connection
, dbapi_connection: PoolProxiedConnection
, execution_options: _ExecuteOptions
, statement: str
, parameters: _DBAPIMultiExecuteParams
) -> ExecutionContext
:
(source)
¶
sqlalchemy.engine.default.DefaultExecutionContext
Undocumented
Optional[ Column[ Any]]
, default: DefaultGenerator
, type_: Optional[ TypeEngine[ Any]]
) -> Any
:
(source)
¶
sqlalchemy.engine.default.DefaultExecutionContext
Undocumented