# Information about the database session is stored here from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from core.config import settings SQLALCHEMY_DATABASE_URL = ( settings.DATABASE_URL ) # get the database url from core/config.py engine = create_engine(SQLALCHEMY_DATABASE_URL) print(SQLALCHEMY_DATABASE_URL) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) def get_db(): # get the database session (if we change the database, we can change it here) db = SessionLocal() try: yield db finally: db.close()