Created
May 7, 2020 20:58
-
-
Save DougAF/3c7bf2ca11788b11a317b4028dc4a2a6 to your computer and use it in GitHub Desktop.
FastAPI database file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from sqlalchemy import create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker | |
SQLALCHEMY_DATABASE_URL = os.getenv("DB_CONN") | |
engine = create_engine(SQLALCHEMY_DATABASE_URL) | |
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
Base = declarative_base() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment