STABLE: Final schema sync, optimized gitignore
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
# /opt/docker/dev/service_finder/backend/app/database.py
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
from app.core.config import settings
|
||||
|
||||
# A .env fájlból olvassuk majd, de teszthez:
|
||||
DATABASE_URL = "postgresql+asyncpg://user:password@db_container_name:5432/db_name"
|
||||
# Most már settings.SQLALCHEMY_DATABASE_URI létezik a property miatt!
|
||||
engine = create_async_engine(
|
||||
str(settings.SQLALCHEMY_DATABASE_URI),
|
||||
echo=settings.DEBUG_MODE,
|
||||
pool_size=20,
|
||||
max_overflow=10,
|
||||
pool_pre_ping=True,
|
||||
)
|
||||
|
||||
engine = create_async_engine(DATABASE_URL, echo=True)
|
||||
SessionLocal = async_sessionmaker(autocommit=False, autoflush=False, bind=engine, class_=AsyncSession)
|
||||
AsyncSessionLocal = async_sessionmaker(
|
||||
autocommit=False,
|
||||
autoflush=False,
|
||||
bind=engine,
|
||||
class_=AsyncSession,
|
||||
expire_on_commit=False
|
||||
)
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
Reference in New Issue
Block a user