diff options
| author | Daniel Lister <dan.lister@gmail.com> | 2019-01-24 16:35:16 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-25 11:19:03 -0500 |
| commit | 2bbd3ac1fb6049fc7195821798f02ce7fa56a7e9 (patch) | |
| tree | ba97d2cda12bb1d7994ae7d58b492b6b803db208 /lib/sqlalchemy/engine/base.py | |
| parent | a11a5f5af6b0c76d6f07a7ed3dd8eff7dda95ed6 (diff) | |
| download | sqlalchemy-2bbd3ac1fb6049fc7195821798f02ce7fa56a7e9.tar.gz | |
Add getters for all execution_options
Added accessors for execution options to Core and ORM, via
:meth:`.Query.get_execution_options`,
:meth:`.Connection.get_execution_options`,
:meth:`.Engine.get_execution_options`, and
:meth:`.Executable.get_execution_options`. PR courtesy Daniel Lister.
Fixes: #4406
Closes: #4465
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4465
Pull-request-sha: 9674688bb5e80471a6a421bac06f995c2e64f8f7
Change-Id: I93ba51d7a2d687e255edd6938db15615e56dd237
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 64303f290..6467e91b9 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -324,6 +324,15 @@ class Connection(Connectable): :ref:`schema_translating` + .. seealso:: + + :meth:`.Engine.execution_options` + + :meth:`.Executable.execution_options` + + :meth:`.Connection.get_execution_options` + + """ # noqa c = self._clone() c._execution_options = c._execution_options.union(opt) @@ -332,6 +341,17 @@ class Connection(Connectable): self.dialect.set_connection_execution_options(c, opt) return c + def get_execution_options(self): + """ Get the non-SQL options which will take effect during execution. + + .. versionadded:: 1.3 + + .. seealso:: + + :meth:`.Connection.execution_options` + """ + return self._execution_options + @property def closed(self): """Return True if this connection is closed.""" @@ -1932,9 +1952,23 @@ class Engine(Connectable, log.Identified): :meth:`.Engine.update_execution_options` - update the execution options for a given :class:`.Engine` in place. + :meth:`.Engine.get_execution_options` + + """ return OptionEngine(self, opt) + def get_execution_options(self): + """ Get the non-SQL options which will take effect during execution. + + .. versionadded: 1.3 + + .. seealso:: + + :meth:`.Engine.execution_options` + """ + return self._execution_options + @property def name(self): """String name of the :class:`~sqlalchemy.engine.interfaces.Dialect` |
