first commit

This commit is contained in:
root
2025-07-17 12:21:03 +02:00
commit 792f209207
10 changed files with 887 additions and 0 deletions

13
db.py Normal file
View File

@ -0,0 +1,13 @@
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import sessionmaker, declarative_base
DATABASE_URL = "postgresql+asyncpg://weather_user:weather_pass@localhost:5432/weather"
engine = create_async_engine(DATABASE_URL, echo=False)
AsyncSessionLocal = sessionmaker(bind=engine, class_=AsyncSession, expire_on_commit=False)
Base = declarative_base()
async def get_session():
async with AsyncSessionLocal() as session:
yield session