def setup(a_session: session, an_engine: Engine): rules_bank = RuleBank() rules_bank._session = a_session event.listen(a_session, "before_flush", before_flush) rules_bank._tables = {} rules_bank._at = datetime.now() rules_bank._engine = an_engine rules_bank._rb_base = declarative_base # FIXME good grief, not appearing, no error return
def setup(a_session: session, an_engine: Engine ): # TODO major - ensure compatible with fab, flask etc """ Initialize the RuleBank """ rules_bank = RuleBank() rules_bank._session = a_session event.listen(a_session, "before_flush", before_flush) rules_bank._tables = {} rules_bank._at = datetime.now() rules_bank._engine = an_engine rules_bank._metadata = MetaData(bind=an_engine, reflect=True) from sqlalchemy.ext.declarative import declarative_base rules_bank._base = declarative_base() return