class Executable(roles.StatementRole, Generative):
Known subclasses: sqlalchemy.orm.query.Query
, sqlalchemy.sql.ddl.DDLElement
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.elements.TextClause
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.schema.DefaultGenerator
, sqlalchemy.sql.selectable.SelectBase
, sqlalchemy.orm.query.FromStatement
, sqlalchemy.sql.elements._IdentifiedClause
Method | _add_context_option |
Add a context option to this statement. |
Method | _set_compile_options |
Assign the compile options to a new value. |
Method | _update_compile_options |
update the _compile_options with new keys. |
Method | execute |
Compile and execute this .Executable . |
Method | execution_options |
Set non-SQL options for the statement which take effect during execution. |
Method | get_execution_options |
Get the non-SQL options which will take effect during execution. |
Method | options |
Apply options to this statement. |
Method | scalar |
Compile and execute this .Executable , returning the result's scalar representation. |
Class Variable | _bind |
Undocumented |
Class Variable | _executable_traverse_internals |
Undocumented |
Class Variable | _with_context_options |
Undocumented |
Class Variable | _with_options |
Undocumented |
Class Variable | is_delete |
Undocumented |
Class Variable | is_dml |
Undocumented |
Class Variable | is_insert |
Undocumented |
Class Variable | is_select |
Undocumented |
Class Variable | is_text |
Undocumented |
Class Variable | is_update |
Undocumented |
Class Variable | supports_execution |
Undocumented |
Instance Variable | _compile_options |
Undocumented |
Instance Variable | _execution_options |
Undocumented |
Property | _effective_plugin_target |
Undocumented |
Property | bind |
Returns the _engine.Engine or _engine.Connection to which this .Executable is bound, or None if none found. |
Inherited from StatementRole
:
Class Variable | _propagate_attrs |
Undocumented |
Class Variable | _role_name |
Undocumented |
Inherited from SQLRole
(via StatementRole
):
Class Variable | allows_lambda |
Undocumented |
Class Variable | uses_inspection |
Undocumented |
Inherited from Generative
:
Method | _generate |
Undocumented |
Add a context option to this statement.
These are callable functions that will be given the CompileState object upon compilation.
A second argument cache_args is required, which will be combined with the __code__ identity of the function itself in order to produce a cache key.
Parameters | |
compile_options | appropriate CacheableOptions structure |
sqlalchemy.sql.ddl.DDLElement
, sqlalchemy.sql.functions.FunctionElement
, sqlalchemy.sql.schema.DefaultGenerator
.Executable
.sqlalchemy.orm.query.Query
Set non-SQL options for the statement which take effect during execution.
Execution options can be set on a per-statement or
per _engine.Connection
basis. Additionally, the
_engine.Engine
and ORM ~.orm.query.Query
objects provide
access to execution options which they in turn configure upon
connections.
The execution_options
method is generative. A new
instance of this statement is returned that contains the options:
statement = select(table.c.x, table.c.y) statement = statement.execution_options(autocommit=True)
Note that only a subset of possible execution options can be applied
to a statement - these include "autocommit" and "stream_results",
but not "isolation_level" or "compiled_cache".
See _engine.Connection.execution_options
for a full list of
possible options.
See Also
_engine.Connection.execution_options
_query.Query.execution_options
.Executable.get_execution_options
sqlalchemy.orm.query.Query
Get the non-SQL options which will take effect during execution.
See Also
.Executable.execution_options
sqlalchemy.orm.query.Query
Apply options to this statement.
In the general sense, options are any kind of Python object that can be interpreted by the SQL compiler for the statement. These options can be consumed by specific dialects or specific kinds of compilers.
The most commonly known kind of option are the ORM level options that apply "eager load" and other loading behaviors to an ORM query. However, options can theoretically be used for many other purposes.
For background on specific kinds of options for specific kinds of statements, refer to the documentation for those option objects.
.Generative.options
to
Core statement objects towards the goal of allowing unified
Core / ORM querying capabilities.See Also
:ref:`deferred_options` - refers to options specific to the usage of ORM queries
:ref:`relationship_loader_options` - refers to options specific to the usage of ORM queries
.Executable
, returning the
result's scalar representation.sqlalchemy.sql.ddl.DDLElement
, sqlalchemy.sql.dml.UpdateBase
, sqlalchemy.sql.expression.CompoundSelect
, sqlalchemy.sql.expression.Select
, sqlalchemy.sql.schema.DefaultGenerator
Returns the _engine.Engine
or _engine.Connection
to
which this .Executable
is bound, or None if none found.
This is a traversal which checks locally, then checks among the "from" clauses of associated objects until a bound engine or connection is found.