"""Creates required DB fixtures.""" import mysql.connector cnx = mysql.connector.connect( host='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, 282, 'adjustment_file_upload', 'statement_period_adjustment_file', 1, '2021-04-12 02:38:45.000000', null, null ) """ cursor.execute(abacus_event_query) cnx.commit() cursor = cnx.cursor() statement_period_adjustment_file_query = """ INSERT INTO statement_period_adjustment_file ( statement_period_adjustment_file_id, statement_period_id, file_name, valid_file_location, invalid_file_location, valid_row_count, invalid_row_count, total_file_amount_multicurrency, total_rounded_amount_multicurrency, md5sum, error_type, created_by, created_at, last_modified_by, last_modified ) VALUES ( 1, 282, 'test_adjustment.xlsx', 's3://qa-abacus-adjustments/test_fixtures/test_adjustment.xlsx', null, null, null, null, null, null, null, 'integration_tests', '2023-11-02 10:53:29', 'integration_tests', '2023-11-02 10:53:34' ), ( 2, 282, 'upc-validation.xlsx', 's3://qa-abacus-adjustments/test_fixtures/upc-validation.xlsx', null, null, null, null, null, null, null, 'integration_tests', '2023-11-02 10:53:29', 'integration_tests', '2023-11-02 10:53:34' ), ( 3, 282, 'invalid_NA_values.xlsx', 's3://qa-abacus-adjustments/test_fixtures/invalid_NA_values.xlsx', null, null, null, null, null, null, null, 'integration_tests', '2023-11-02 10:53:29', 'integration_tests', '2023-11-02 10:53:34' ) """ cursor.execute(statement_period_adjustment_file_query) cnx.commit() cursor = cnx.cursor() update_statement_period_to_current_query = """ UPDATE statement_period t SET t.statement_period_status = 'current' WHERE t.statement_period_id = 282 """ cursor.execute(update_statement_period_to_current_query) cnx.commit() cnx.close() print('Fixtures were created.')