Example #1
0
def model_query(*args, **kwargs):
    """Query helper

    :param session: if present, the session to use
    """
    session = kwargs.get('session') or sqlalchemy_session.get_session()
    query = session.query(*args)
    return query
Example #2
0
 def __init__(self, conf):
     url = conf.database_connection
     if url == 'sqlite://':
         url = os.environ.get('CEILOMETER_TEST_SQL_URL', url)
     LOG.info('connecting to %s', url)
     self.session = sqlalchemy_session.get_session(url, conf)
Example #3
0
 def _get_connection(self, conf):
     """Return a connection to the database.
     """
     return sqlalchemy_session.get_session()
Example #4
0
 def __init__(self, conf):
     url = conf.database_connection
     if url == 'sqlite://':
         url = os.environ.get('CEILOMETER_TEST_SQL_URL', url)
     LOG.info('connecting to %s', url)
     self.session = sqlalchemy_session.get_session(url, conf)