diff options
author | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-05-21 13:05:16 +0300 |
---|---|---|
committer | Roman Podoliaka <rpodolyaka@mirantis.com> | 2014-06-03 12:12:14 +0300 |
commit | 28df4edde0eca54e4783e5e1e8253689af941779 (patch) | |
tree | 32e674f3d4a03e1a5097825c43f78d1e0e0edb88 | |
parent | fad6e5c2302811e8721123fa8e7f43a5bdecb068 (diff) | |
download | oslo-db-28df4edde0eca54e4783e5e1e8253689af941779.tar.gz |
Make get_session() pass kwargs to a sessionmaker
get_session() method is used to construct a new SQLAlchemy session
instance. Currently, it takes two keyword arguments which are used
to configure the Session instance to be created. Actually, there are
more arguments which can be passed to a sessiomaker instance. oslo.db
should not stay in the way of a developer who wants to use specific
features of SQLAlchemy session: it should handle oslo.db specific
arguments and pass keyword arguments as is when calling the
sessionmaker.
Change-Id: I1f577a30586eafe1295bcbd15a6a881e9f7f65ab
-rw-r--r-- | oslo/db/sqlalchemy/session.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/oslo/db/sqlalchemy/session.py b/oslo/db/sqlalchemy/session.py index 509f657..3254a9b 100644 --- a/oslo/db/sqlalchemy/session.py +++ b/oslo/db/sqlalchemy/session.py @@ -859,21 +859,12 @@ class EngineFacade(object): def get_session(self, **kwargs): """Get a Session instance. - If passed, keyword arguments values override the ones used when the - sessionmaker instance was created. - - :keyword autocommit: use autocommit mode for created Session instances - :type autocommit: bool - - :keyword expire_on_commit: expire session objects on commit - :type expire_on_commit: bool + Keyword arugments will be passed to a sessionmaker instance as is (if + passed, they will override the ones used when the sessionmaker instance + was created). See SQLAlchemy Session docs for details. """ - for arg in kwargs: - if arg not in ('autocommit', 'expire_on_commit'): - del kwargs[arg] - return self._session_maker(**kwargs) @classmethod |