All checks were successful
Build and Push to Private Registry101 / build (push) Successful in 8s
Co-authored-by: stephen schuresko <mynameisdeleted@gmail.com> Reviewed-on: https://192.168.1.134:3000/posts-api/papi-py/pulls/6
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()
|