Skip to content

Commit

Permalink
Update to use async_sessionmaker
Browse files Browse the repository at this point in the history
  • Loading branch information
levinotik authored Aug 2, 2023
1 parent 9622a47 commit dfa5510
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
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
Expand All @@ -17,7 +18,7 @@

# 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, class_=AsyncSession)


# Dependency
Expand Down

0 comments on commit dfa5510

Please sign in to comment.