def init_model(engine):
    """
    Initializes the shared SQLAlchemy state in the L{coilmq.store.sa.model} module.
    
    @param engine: The SQLAlchemy engine instance.
    @type engine: C{sqlalchemy.Engine}
    """
    meta.engine = engine
    meta.metadata = MetaData(bind=meta.engine)
    meta.Session = scoped_session(sessionmaker(bind=meta.engine))
    model.setup_tables()
Esempio n. 2
0
def init_model(engine, create=True, drop=False):
    """
    Initializes the shared SQLAlchemy state in the L{coilmq.store.sa.model} module.
    
    @param engine: The SQLAlchemy engine instance.
    @type engine: C{sqlalchemy.Engine}
    
    @param create: Whether to create the tables (if they do not exist).
    @type create: C{bool}
    
    @param drop: Whether to drop the tables (if they exist).
    @type drop: C{bool}
    """
    meta.engine = engine
    meta.metadata = MetaData(bind=meta.engine)
    meta.Session = scoped_session(sessionmaker(bind=meta.engine))
    model.setup_tables(create=create, drop=drop)