<reponame>duongcongnha/ppattention-intermediary<gh_stars>1-10
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from util.common import read_db_config

connection_string = read_db_config(config_path="../../settings/db_config.yml")
engine = create_engine(connection_string)
# use session_factory() to get a new Session
_SessionFactory = sessionmaker(bind=engine)

Base = declarative_base()


def session_factory():
    Base.metadata.create_all(engine)
    return _SessionFactory()
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from util.common import read_db_config

connection_string = read_db_config(config_path="../../settings/db_config.yml")
engine = create_engine(connection_string)
# use session_factory() to get a new Session
_SessionFactory = sessionmaker(bind=engine)

Base = declarative_base()


def session_factory():
    Base.metadata.create_all(engine)
    return _SessionFactory()
# use session_factory() to get a new Session