first commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from app.core.config import settings
|
||||
|
||||
engine = create_engine(settings.database_url, future=True)
|
||||
SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False, future=True)
|
||||
|
||||
|
||||
def get_db() -> Session:
|
||||
database = SessionLocal()
|
||||
|
||||
try:
|
||||
yield database
|
||||
finally:
|
||||
database.close()
|
||||
Reference in New Issue
Block a user