qa (#6)
All checks were successful
Build and Push to Private Registry101 / build (push) Successful in 8s
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
This commit was merged in pull request #6.
This commit is contained in:
20
db.py
Normal file
20
db.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user