def tearDown(self): # Drop MySQL tables. db_session.remove() engine.dispose() delete_db() # Empty ES index. es.drop_and_create_index() return super(DatabaseTest, self).tearDown()
def setUp(self): # pylint:disable=unused-variable # Imports are used by SQLAlchemy to know what tables to create. from labonneboite.importer.models.computing import Dpae, DpaeStatistics, ImportTask # pylint:enable=unused-variable db_session.remove() engine.dispose() delete_db() init_db() return super(DatabaseTest, self).setUp()
def shutdown_session(exception=None): db_session.remove() engine.dispose()
except Exception as err: print('> error executing request', err, '\n> Did you forget to set the env var `ENABLE_DB_INFILE=1`?') def main(): print('\nStarting script with LBB_ENV:', os.environ.get('LBB_ENV', None), 'and command:', command, 'and key:', REASON_KEY, '\n') if (command == 'count'): cbs_count_records() elif (command == 'delete'): cbs_count_records() cbs_delete_records() cbs_count_records() elif (command == 'insert'): cbs_count_records() cbs_insert_records() cbs_count_records() else: print('Unknown command', command) if __name__ == "__main__": start_time = time.time() main() engine.dispose() print("--- %s seconds ---" % (time.time() - start_time))