All checks were successful
Build and Push to Private Registry101 / build (push) Successful in 10s
21 lines
469 B
Python
21 lines
469 B
Python
from sqlalchemy import create_engine, Column, Integer,String, ForeignKey
|
|
from sqlalchemy.engine import URL
|
|
from sqlalchemy.orm import sessionmaker, Session, declarative_base
|
|
|
|
|
|
# Database setup
|
|
DATABASE_URL = "sqlite:///./test.db"
|
|
engine = create_engine(DATABASE_URL)
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
Base = declarative_base()
|
|
|
|
|
|
|
|
|
|
def get_db():
|
|
db = SessionLocal()
|
|
try:
|
|
yield db
|
|
finally:
|
|
db.close()
|