mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
refactor project settings
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from collections.abc import AsyncGenerator
|
||||
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
@@ -10,13 +9,11 @@ from app.utils import get_logger
|
||||
logger = get_logger(__name__)
|
||||
|
||||
global_settings = config.get_settings()
|
||||
url = global_settings.asyncpg_url
|
||||
|
||||
engine = create_async_engine(
|
||||
url,
|
||||
global_settings.asyncpg_url,
|
||||
future=True,
|
||||
echo=True,
|
||||
json_serializer=jsonable_encoder,
|
||||
)
|
||||
|
||||
# expire_on_commit=False will prevent attributes from being expired
|
||||
|
||||
Reference in New Issue
Block a user