set expire_on_commit= to False by default
This commit is contained in:
parent
6055c4ed3b
commit
da6c767698
1 changed files with 2 additions and 2 deletions
|
|
@ -45,10 +45,10 @@ class SQLAlchemy:
|
||||||
def _ensure_engine(self):
|
def _ensure_engine(self):
|
||||||
if self.engine is None:
|
if self.engine is None:
|
||||||
raise RuntimeError('database is not connected')
|
raise RuntimeError('database is not connected')
|
||||||
async def begin(self) -> AsyncSession:
|
async def begin(self, *, expire_on_commit = False, **kw) -> AsyncSession:
|
||||||
self._ensure_engine()
|
self._ensure_engine()
|
||||||
## XXX is it accurate?
|
## XXX is it accurate?
|
||||||
s = AsyncSession(self.engine)
|
s = AsyncSession(self.engine, expire_on_commit=expire_on_commit, **kw)
|
||||||
self._sessions.append(s)
|
self._sessions.append(s)
|
||||||
return s
|
return s
|
||||||
async def __aenter__(self) -> AsyncSession:
|
async def __aenter__(self) -> AsyncSession:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue