odapi/database/__init__.py

15 lines
432 B
Python

from constants import DB
from sqlalchemy import MetaData, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from databases import Database
metadata = MetaData()
engine = create_engine(DB)
metadata.create_all(engine)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
database = Database(DB)
from database import models