Exemplo n.º 1
0
Arquivo: api.py Projeto: Open-SFC/nscs
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"))
Exemplo n.º 2
0
Arquivo: api.py Projeto: Open-SFC/nscs
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