Merge pull request #101 from levinotik/patch-1

Update to use async_sessionmaker
This commit is contained in:
Jakub Miazek 2023-08-02 10:45:42 +02:00 committed by GitHub
commit 2c1d006da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
from collections.abc import AsyncGenerator
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.asyncio import async_sessionmaker
from app import config
from app.utils.logging import AppLogger
@ -17,7 +17,7 @@ engine = create_async_engine(
# expire_on_commit=False will prevent attributes from being expired
# after commit.
AsyncSessionFactory = sessionmaker(engine, autoflush=False, expire_on_commit=False, class_=AsyncSession)
AsyncSessionFactory = async_sessionmaker(engine, autoflush=False, expire_on_commit=False,)
# Dependency