Ejemplo n.º 1
0
def configure_db():
    """Configure database.

    Establish the database, create an engine if needed, and register
    the models.
    """
    session.get_engine(sqlite_fk=True)
    register_models()
Ejemplo n.º 2
0
 def start(self):
     # We may have just forked from parent process.  A quick disposal of the
     # existing sql connections avoids producting 500 errors later when they
     # are discovered to be broken.
     session.get_engine(sqlite_fk=True).pool.dispose()
     self._server = self._service.pool.spawn(self._service._run,
                                             self._application,
                                             self._service._socket)
Ejemplo n.º 3
0
 def start(self):
     # We may have just forked from parent process.  A quick disposal of the
     # existing sql connections avoids producting 500 errors later when they
     # are discovered to be broken.
     session.get_engine(sqlite_fk=True).pool.dispose()
     self._server = self._service.pool.spawn(self._service._run,
                                             self._application,
                                             self._service._socket)
Ejemplo n.º 4
0
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"))
Ejemplo n.º 5
0
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"))
Ejemplo n.º 6
0
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
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
 def start(self):
     # We may have just forked from parent process.  A quick disposal of the
     # existing sql connections avoids producing errors later when they are
     # discovered to be broken.
     session.get_engine(sqlite_fk=True).pool.dispose()
     self._server = self._plugin.start_rpc_listener()
Ejemplo n.º 9
0
 def start(self):
     # We may have just forked from parent process.  A quick disposal of the
     # existing sql connections avoids producing errors later when they are
     # discovered to be broken.
     session.get_engine(sqlite_fk=True).pool.dispose()
     self._server = self._plugin.start_rpc_listener()