def unregister_models(base=BASE): """Unregister Models, useful clearing out data before testing.""" try: engine = session.get_engine(sqlite_fk=True) base.metadata.drop_all(engine) except Exception: LOG.exception(_("Database exception"))
def register_models(base=BASE): """Register Models and create properties.""" try: engine = session.get_engine(sqlite_fk=True) base.metadata.create_all(engine) except sql.exc.OperationalError as e: LOG.info(_("Database registration exception: %s"), e) return False return True