|
|
|
|
|
|
|
|
# If an engine is provided, create a sessionmaker from it |
|
|
# If an engine is provided, create a sessionmaker from it |
|
|
if isinstance(session_factory, Engine): |
|
|
if isinstance(session_factory, Engine): |
|
|
self._session_factory = sessionmaker(bind=session_factory, expire_on_commit=False) |
|
|
self._session_factory = sessionmaker(bind=session_factory, expire_on_commit=False) |
|
|
else: |
|
|
|
|
|
|
|
|
elif isinstance(session_factory, sessionmaker): |
|
|
self._session_factory = session_factory |
|
|
self._session_factory = session_factory |
|
|
|
|
|
else: |
|
|
|
|
|
raise ValueError( |
|
|
|
|
|
f"Invalid session_factory type {type(session_factory).__name__}; expected sessionmaker or Engine" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
self._tenant_id = tenant_id |
|
|
self._tenant_id = tenant_id |
|
|
self._app_id = app_id |
|
|
self._app_id = app_id |