We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2699692 commit 9977523Copy full SHA for 9977523
aura-core/db.py
@@ -0,0 +1,12 @@
1
+from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
2
+from sqlalchemy.orm import sessionmaker
3
+import os
4
+
5
+DATABASE_URL = os.getenv("DATABASE_URL")
6
7
+engine = create_async_engine(DATABASE_URL, echo=True, future=True)
8
+SessionLocal = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
9
10
+async def get_db():
11
+ async with SessionLocal() as session:
12
+ yield session
0 commit comments