summaryrefslogtreecommitdiff
path: root/oslo_db/sqlalchemy/enginefacade.py
diff options
context:
space:
mode:
authorSergey Nikitin <snikitin@mirantis.com>2015-11-11 11:45:49 +0300
committerSergey Nikitin <snikitin@mirantis.com>2015-11-11 12:18:28 +0300
commit7cc914fc1d7cb63439361b8323bafb3ba8fcd61c (patch)
tree57863738532a96f010baf60096f9ffa98f626259 /oslo_db/sqlalchemy/enginefacade.py
parentdcbf7b81a889a86d62d36b61dd7035ac91ce5822 (diff)
downloadoslo-db-7cc914fc1d7cb63439361b8323bafb3ba8fcd61c.tar.gz
Added method get_legacy_facade() to the _TransactionContextManager
This public method was added to be able to create several legacy facades from several transaction context managers. It could be used in Nova where we have two DBs. There we need some legal way to create two legacy facades because right now in Nova we create facades by using private field _factory. It is not quite right. Change-Id: I96b3dbcbc5a05ac025c247ae6d8abfc988d0295e
Diffstat (limited to 'oslo_db/sqlalchemy/enginefacade.py')
-rw-r--r--oslo_db/sqlalchemy/enginefacade.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/enginefacade.py b/oslo_db/sqlalchemy/enginefacade.py
index 0985ea8..111f033 100644
--- a/oslo_db/sqlalchemy/enginefacade.py
+++ b/oslo_db/sqlalchemy/enginefacade.py
@@ -622,6 +622,17 @@ class _TransactionContextManager(object):
"""
self._factory.configure(**kw)
+ def get_legacy_facade(self):
+ """Return a :class:`.LegacyEngineFacade` for factory from this context.
+
+ This facade will make use of the same engine and sessionmaker
+ as this factory, however will not share the same transaction context;
+ the legacy facade continues to work the old way of returning
+ a new Session each time get_session() is called.
+ """
+
+ return self._factory.get_legacy_facade()
+
@property
def replace(self):
"""Modifier to replace the global transaction factory with this one."""
@@ -827,7 +838,7 @@ def get_legacy_facade():
a new Session each time get_session() is called.
"""
- return _context_manager._factory.get_legacy_facade()
+ return _context_manager.get_legacy_facade()
reader = _context_manager.reader