class DefaultExecutionContext(interfaces.ExecutionContext):
Known subclasses: sqlalchemy.databases.firebird.FBExecutionContext
, sqlalchemy.databases.mssql.MSExecutionContext
, sqlalchemy.databases.mysql.MySQLExecutionContext
, sqlalchemy.databases.oracle.OracleExecutionContext
, sqlalchemy.databases.postgresql.PGExecutionContext
, sqlalchemy.databases.sqlite.SQLiteExecutionContext
, sqlalchemy.databases.sybase.SybaseExecutionContext
Undocumented
Method | create_cursor |
Return a new cursor generated from this ExecutionContext's connection. |
Method | get_current_parameters |
Return a dictionary of parameters applied to the current row. |
Method | get_lastrowid |
return self.cursor.lastrowid, or equivalent, after an INSERT. |
Method | get_out_parameter_values |
Return a sequence of OUT parameter values from a cursor. |
Method | get_result_processor |
Return a 'result processor' for a given type as present in cursor.description. |
Method | handle_dbapi_exception |
Receive a DBAPI exception which occurred upon execute, result fetch, etc. |
Method | lastrow_has_defaults |
Return True if the last INSERT or UPDATE row contained inlined or database-side defaults. |
Method | post_exec |
Called after the execution of a compiled statement. |
Method | pre_exec |
Called before an execution of a compiled statement. |
Method | should_autocommit_text |
Parse the given textual statement and return True if it refers to a "committable" statement |
Instance Variable | current_parameters |
A dictionary of parameters applied to the current row. |
Class Method | _init_compiled |
Initialize execution context for a Compiled construct. |
Class Method | _init_ddl |
Initialize execution context for a DDLElement construct. |
Class Method | _init_default |
Initialize execution context for a ColumnDefault construct. |
Class Method | _init_statement |
Initialize execution context for a string SQL statement. |
Method | _exec_default |
Undocumented |
Method | _exec_default_clause_element |
Undocumented |
Method | _execute_scalar |
Execute a string statement on the current cursor, returning a scalar result. |
Method | _get_cache_stats |
Undocumented |
Method | _process_executemany_defaults |
Undocumented |
Method | _process_executesingle_defaults |
Undocumented |
Method | _set_input_sizes |
Given a cursor and ClauseParameters, call the appropriate style of setinputsizes() on the cursor, using DB-API types from the bind parameter's TypeEngine objects. |
Method | _setup_dml_or_text_result |
Undocumented |
Method | _setup_ins_pk_from_empty |
Undocumented |
Method | _setup_ins_pk_from_implicit_returning |
Undocumented |
Method | _setup_ins_pk_from_lastrowid |
Undocumented |
Method | _setup_out_parameters |
Undocumented |
Method | _setup_result_proxy |
Undocumented |
Method | _use_server_side_cursor |
Undocumented |
Method | create_default_cursor |
Undocumented |
Method | create_server_side_cursor |
Undocumented |
Method | get_insert_default |
Undocumented |
Method | get_update_default |
Undocumented |
Method | supports_sane_multi_rowcount |
Undocumented |
Method | supports_sane_rowcount |
Undocumented |
Class Variable | _translate_colname |
Undocumented |
Class Variable | cache_stats |
Undocumented |
Class Variable | exclude_set_input_sizes |
Undocumented |
Class Variable | include_set_input_sizes |
Undocumented |
Instance Variable | _dbapi_connection |
Undocumented |
Instance Variable | _expanded_parameters |
Undocumented |
Instance Variable | _is_explicit_returning |
Undocumented |
Instance Variable | _is_future_result |
Undocumented |
Instance Variable | _is_implicit_returning |
Undocumented |
Instance Variable | _is_server_side |
Undocumented |
Instance Variable | _soft_closed |
Undocumented |
Instance Variable | cache_hit |
Undocumented |
Instance Variable | compiled |
Undocumented |
Instance Variable | compiled_parameters |
Undocumented |
Instance Variable | cursor |
Undocumented |
Instance Variable | dialect |
Undocumented |
Instance Variable | executemany |
Undocumented |
Instance Variable | execution_options |
Undocumented |
Instance Variable | extracted_parameters |
Undocumented |
Instance Variable | invoked_statement |
Undocumented |
Instance Variable | is_crud |
Undocumented |
Instance Variable | is_text |
Undocumented |
Instance Variable | isddl |
Undocumented |
Instance Variable | isdelete |
Undocumented |
Instance Variable | isinsert |
Undocumented |
Instance Variable | isupdate |
Undocumented |
Instance Variable | parameters |
Undocumented |
Instance Variable | result_column_struct |
Undocumented |
Instance Variable | returned_default_rows |
Undocumented |
Instance Variable | root_connection |
Undocumented |
Instance Variable | statement |
Undocumented |
Instance Variable | unicode_statement |
Undocumented |
Property | connection |
Undocumented |
Property | engine |
Undocumented |
Property | identifier_preparer |
Undocumented |
Property | inserted_primary_key_rows |
Undocumented |
Property | no_parameters |
Undocumented |
Property | postfetch_cols |
Undocumented |
Property | prefetch_cols |
Undocumented |
Property | returning_cols |
Undocumented |
Property | rowcount |
Undocumented |
Property | should_autocommit |
Undocumented |
Inherited from ExecutionContext
:
Method | get_result_cursor_strategy |
Return a result cursor strategy for a given result object. |
Method | get_rowcount |
Return the DBAPI cursor.rowcount value, or in some cases an interpreted value. |
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.
Return a dictionary of parameters applied to the current row.
This method can only be used in the context of a user-defined default
generation function, e.g. as described at
:ref:`context_default_functions`. When invoked, a dictionary is
returned which includes entries for each column/value pair that is part
of the INSERT or UPDATE statement. The keys of the dictionary will be
the key value of each _schema.Column
,
which is usually synonymous
with the name.
.DefaultExecutionContext.get_current_parameters
which provides more functionality over the existing
.DefaultExecutionContext.current_parameters
attribute.Parameters | |
isolate_multiinsert_groups | Undocumented |
isolate_multiinsert_groups=True | indicates that multi-valued
INSERT constructs created using _expression.Insert.values
should be
handled by returning only the subset of parameters that are local
to the current column default invocation. When False, the
raw parameters of the statement are returned including the
naming convention used in the case of multi-valued INSERT. |
sqlalchemy.databases.mssql.MSExecutionContext
, sqlalchemy.databases.sybase.SybaseExecutionContext
, sqlalchemy.dialects.mysql.pyodbc.MySQLExecutionContext_pyodbc
return self.cursor.lastrowid, or equivalent, after an INSERT.
This may involve calling special cursor functions, issuing a new SELECT on the cursor (or a new one), or returning a stored value that was calculated within post_exec().
This function will only be called for dialects which support "implicit" primary key generation, keep preexecute_autoincrement_sequences set to False, and when no explicit id value was bound to the statement.
The function is called once for an INSERT statement that would need to
return the last inserted primary key for those dialects that make use
of the lastrowid concept. In these cases, it is called directly after
.ExecutionContext.post_exec
.
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 .SQLCompiler
object which has the
.SQLCompiler.has_out_parameters
flag set. This flag in turn
will be set to True if the statement itself has .BindParameter
objects that have the .isoutparam flag set which are consumed by
the .SQLCompiler.visit_bindparam
method. If the dialect
compiler produces .BindParameter
objects with .isoutparam
set which are not handled by .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.
.ExecutionContext.get_out_parameter_values
, which is invoked
automatically by the .DefaultExecutionContext
when there
are .BindParameter
objects with the .isoutparam flag
set. This replaces the practice of setting out parameters within
the now-removed get_result_proxy() method.See Also
.ExecutionContext.get_result_cursor_strategy
Return a 'result processor' for a given type as present in cursor.description.
This has a default implementation that dialects can override for context-sensitive result type handling.
sqlalchemy.databases.mssql.MSExecutionContext
, sqlalchemy.dialects.postgresql.asyncpg.PGExecutionContext_asyncpg
sqlalchemy.databases.mssql.MSExecutionContext
, sqlalchemy.databases.sybase.SybaseExecutionContext
, sqlalchemy.dialects.oracle.cx_oracle.OracleExecutionContext_cx_oracle
, sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2
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.databases.mssql.MSExecutionContext
, sqlalchemy.databases.sybase.SybaseExecutionContext
, sqlalchemy.dialects.oracle.cx_oracle.OracleExecutionContext_cx_oracle
, sqlalchemy.dialects.postgresql.asyncpg.PGExecutionContext_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGExecutionContext_pg8000
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.databases.mysql.MySQLExecutionContext
, sqlalchemy.databases.postgresql.PGExecutionContext
A dictionary of parameters applied to the current row.
This attribute is only available in the context of a user-defined default
generation function, e.g. as described at :ref:`context_default_functions`.
It consists of a dictionary which includes entries for each column/value
pair that is to be part of the INSERT or UPDATE statement. The keys of the
dictionary will be the key value of each _schema.Column
,
which is usually
synonymous with the name.
Note that the .DefaultExecutionContext.current_parameters
attribute
does not accommodate for the "multi-values" feature of the
_expression.Insert.values
method. The
.DefaultExecutionContext.get_current_parameters
method should be
preferred.
Execute a string statement on the current cursor, returning a scalar result.
Used to fire off sequences, default phrases, and "select lastrowid" types of statements individually or in the context of a parent INSERT or UPDATE statement.
Given a cursor and ClauseParameters, call the appropriate style of setinputsizes() on the cursor, using DB-API types from the bind parameter's TypeEngine objects.
This method only called by those dialects which require it, currently cx_oracle, asyncpg and pg8000.
sqlalchemy.databases.mysql.MySQLExecutionContext
, sqlalchemy.dialects.postgresql.asyncpg.PGExecutionContext_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGExecutionContext_pg8000
, sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2
, sqlalchemy.dialects.sqlite.aiosqlite.SQLiteExecutionContext_aiosqlite
Undocumented
sqlalchemy.databases.mssql.MSExecutionContext
, sqlalchemy.databases.postgresql.PGExecutionContext
Undocumented