diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2021-12-09 22:11:37 +0100 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2021-12-10 15:33:50 +0100 |
| commit | a7c004dff86a0bdd228f70800f8f8e3872d4aad1 (patch) | |
| tree | 569fd47a118424f159110943d390b2dc586b4510 /lib/sqlalchemy | |
| parent | 6d66c6445dbc19c281c0c3a1a33e0e34e24b840b (diff) | |
| download | sqlalchemy-a7c004dff86a0bdd228f70800f8f8e3872d4aad1.tar.gz | |
Add execution options to ``Session.get``
Fixes: #7410
Change-Id: Iab6427b8b4c2ada8c31ef69f92d27c1185dbb6b1
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index f75f2ac9f..e921bb8f0 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -2564,6 +2564,7 @@ class Session(_SessionClassMethods): populate_existing=False, with_for_update=None, identity_token=None, + execution_options=None, ): """Return an instance based on the given primary key identifier, or ``None`` if not found. @@ -2644,6 +2645,19 @@ class Session(_SessionClassMethods): :meth:`_query.Query.with_for_update`. Supersedes the :paramref:`.Session.refresh.lockmode` parameter. + :param execution_options: optional dictionary of execution options, + which will be associated with the query execution if one is emitted. + This dictionary can provide a subset of the options that are + accepted by :meth:`_engine.Connection.execution_options`, and may + also provide additional options understood only in an ORM context. + + .. versionadded:: 1.4.29 + + .. seealso:: + + :ref:`orm_queryguide_execution_options` - ORM-specific execution + options + :return: The object instance, or ``None``. """ @@ -2655,6 +2669,7 @@ class Session(_SessionClassMethods): populate_existing=populate_existing, with_for_update=with_for_update, identity_token=identity_token, + execution_options=execution_options, ) def _get_impl( |
