def rebuild_db(): try: connection = connect_db() msg = DbContext.rebuild_database(connection, app.open_resource) except Exception as e: msg = 'Rebuilding the database an exception took place: %s' % str(e) return msg
def connect_db(): database_path = os.path.join(APP_ROOT, 'database/' + app.config['DATABASE']) return DbContext.get_connection(database_path)
def get_db_connection(cls): db_path = DatabaseUtils._get_database_test_path() return DbContext.get_connection(db_path)
def get_db_connection_in_memory(cls): return DbContext.get_connection(':memory:')
def recreate_database(cls, connection): return DbContext.rebuild_database(connection, cls._open_schema_file)