def create_tables(systemname, dbfile): base = get_base() sqlite_engine = DbFactory.get_db_engine(systemname, dbfile).get_database() Location.__table__.create(sqlite_engine, checkfirst=True) Trip.__table__.create(sqlite_engine, checkfirst=True) sqlite_engine.dispose()
def create_tables(systemname, dbfile): base = get_base() sqlite_engine = DbFactory.get_db_engine(systemname, dbfile).get_database() Centers.__table__.create(sqlite_engine, checkfirst=True) GoodStores.__table__.create(sqlite_engine, checkfirst=True) ShopDemand.__table__.create(sqlite_engine, checkfirst=True) Results.__table__.create(sqlite_engine, checkfirst=True) sqlite_engine.dispose()
def create_tables(systemname, dbfile): base = get_base() sqlite_engine = DbFactory.get_db_engine(systemname, dbfile).get_database() Production.__table__.create(sqlite_engine, checkfirst=True) MilkDemand.__table__.create(sqlite_engine, checkfirst=True) CowFeed.__table__.create(sqlite_engine, checkfirst=True) Optcows.__table__.create(sqlite_engine, checkfirst=True) Optmilk.__table__.create(sqlite_engine, checkfirst=True) sqlite_engine.dispose()
def create_tables(systemname, dbfile): """ Creates Location and Trip tables on the database. """ base = get_base() sqlite_engine = DbFactory.get_db_engine(systemname, dbfile).get_database() Location.__table__.create(sqlite_engine, checkfirst=True) # Location table creation. Trip.__table__.create(sqlite_engine, checkfirst=True) # Trip table creation. sqlite_engine.dispose()
def create_tables(systemname, dbfile): base = get_base() sqlite_engine = DbFactory.get_db_engine(systemname, dbfile).get_database() GameVariables.__table__.create(sqlite_engine, checkfirst=True) NetworkSlots.__table__.create(sqlite_engine, checkfirst=True) TeamData.__table__.create(sqlite_engine, checkfirst=True) Schedule.__table__.create(sqlite_engine, checkfirst=True) Opponents.__table__.create(sqlite_engine, checkfirst=True) sqlite_engine.dispose()
from sqlalchemy import Column, String, DateTime, BigInteger from sqlalchemy.orm import relationship from app.db.settings import get_base base=get_base() class Trip(base): __tablename__ = 'trip' ROW_ID = Column(BigInteger, primary_key=True) TRIP_DURATION = Column(BigInteger, nullable=False) START_DATE= Column(String, nullable=False) START_STATION= Column(String(8), nullable=False) STOP_DATE= Column(String, nullable=False) STOP_STATION= Column(String(8), nullable=False) BIKE_ID= Column(String(6), nullable=False) USER_TYPE= Column(String(15), nullable=False)
def __enter__(self): base = get_base() self.db = DbFactory.get_db_engine(self.dbname, self.file).get_database() self.session = sessionmaker(bind=self.db)() return self.session