16 lines
684 B
Python
16 lines
684 B
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import sessionmaker
|
|
import config
|
|
|
|
# SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
|
|
# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
|
|
|
|
# create_engine("mysql+pymysql://%:%@%:%/dev", connect_args={"check_same_thread": False}) % (config.DB('user'), config.DB('pass'), config.DB('host'), config.DB('port'))
|
|
|
|
engine = create_engine("mysql+pymysql://%:%@%:%/dev") % (config.DB('user'), config.DB('pass'), config.DB('host'), config.DB('port'))
|
|
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
|
|
Base = declarative_base()
|