"""Creates required DB fixtures.""" import mysql.connector cnx = mysql.connector.connect( host='snapshot-contracts-mysql', port='3306', database='royalty_accounting', user='db_user', password='db_pass', ) cursor = cnx.cursor() abacus_event_query = """ INSERT INTO abacus_event ( abacus_event_id, statement_period_id, event_name, target_type, target_id, event_date, previous_abacus_event_id, rolled_back_at ) VALUES ( 1, 318, 'snapshot_account_contracts', 'statement_period', 318, '2021-04-12 02:38:45.000000', null, null ) """ cursor.execute(abacus_event_query) cnx.commit() cursor = cnx.cursor() update_statement_period_to_current_query = """ UPDATE statement_period t SET t.statement_period_status = 'closed' WHERE t.statement_period_id = 318 """ cursor.execute(update_statement_period_to_current_query) cnx.commit() cnx.close() print('Fixtures were created.')