diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2019-01-25 19:55:25 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-01-25 19:55:25 +0000 |
| commit | c9a31767e0d3a15ab45101aca21924cb4434c7b9 (patch) | |
| tree | b008620f8b750de4e59b5a9c8da1aecea6f39e79 /lib/sqlalchemy | |
| parent | 2f32a1c8e0fa9ee6cf92e9fb07d2cde80194badb (diff) | |
| parent | 2bbd3ac1fb6049fc7195821798f02ce7fa56a7e9 (diff) | |
| download | sqlalchemy-c9a31767e0d3a15ab45101aca21924cb4434c7b9.tar.gz | |
Merge "Add getters for all execution_options"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 34 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 15 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/base.py | 17 |
3 files changed, 64 insertions, 2 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` diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 3bb36f1e2..0db8b6dd0 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -1554,6 +1554,17 @@ class Query(object): """ return self.with_hint(None, text, dialect_name) + def get_execution_options(self): + """ Get the non-SQL options which will take effect during execution. + + .. versionadded:: 1.3 + + .. seealso:: + + :meth:`.Query.execution_options` + """ + return self._execution_options + @_generative() def execution_options(self, **kwargs): """ Set non-SQL options which take effect during execution. @@ -1565,6 +1576,10 @@ class Query(object): automatically if the :meth:`~sqlalchemy.orm.query.Query.yield_per()` method is used. + .. seealso:: + + :meth:`.Query.get_execution_options` + """ self._execution_options = self._execution_options.union(kwargs) diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index a5a0e4377..c5e5fd8a1 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -365,9 +365,11 @@ class Executable(Generative): .. seealso:: - :meth:`.Connection.execution_options()` + :meth:`.Connection.execution_options` - :meth:`.Query.execution_options()` + :meth:`.Query.execution_options` + + :meth:`.Executable.get_execution_options` """ if "isolation_level" in kw: @@ -384,6 +386,17 @@ class Executable(Generative): ) self._execution_options = self._execution_options.union(kw) + def get_execution_options(self): + """ Get the non-SQL options which will take effect during execution. + + .. versionadded:: 1.3 + + .. seealso:: + + :meth:`.Executable.execution_options` + """ + return self._execution_options + def execute(self, *multiparams, **params): """Compile and execute this :class:`.Executable`.""" e = self.bind |
