init: documentation and prototypes
This commit is contained in:
parent
e936fb41fa
commit
45d60fc1a9
51 changed files with 2476 additions and 1 deletions
11
prototype-grok4.1/direktvermittlungde-backend/database.py
Normal file
11
prototype-grok4.1/direktvermittlungde-backend/database.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||
from .models import Base
|
||||
|
||||
DATABASE_URL = "postgresql+asyncpg://user:pass@localhost/dvd_db" # From env
|
||||
|
||||
engine = create_async_engine(DATABASE_URL, echo=True)
|
||||
async_session = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||
|
||||
async def init_db():
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
Loading…
Add table
Add a link
Reference in a new issue