mssql_script14.py 1.45 KB
import pyodbc

hil_sql = """
    ALTER TABLE hil_auto_settlement ADD ocr_whole_result_pass bit;
    ALTER TABLE hil_auto_settlement ALTER COLUMN ocr_auto_result_pass bit;
    
    create index hil_auto_settlement_rpa_activated_time_index
       on hil_auto_settlement (rpa_activated_time);
       
    create index hil_auto_settlement_rpa_get_case_from_ocr_time_index
       on hil_auto_settlement (rpa_get_case_from_ocr_time);
    
    create index hil_auto_settlement_ocr_latest_comparison_time_index
       on hil_auto_settlement (ocr_latest_comparison_time);
"""

afc_sql = """
    ALTER TABLE afc_auto_settlement ADD ocr_whole_result_pass bit;
    ALTER TABLE afc_auto_settlement ALTER COLUMN ocr_auto_result_pass bit;
    
    create index afc_auto_settlement_rpa_activated_time_index
       on afc_auto_settlement (rpa_activated_time);
       
    create index afc_auto_settlement_rpa_get_case_from_ocr_time_index
       on afc_auto_settlement (rpa_get_case_from_ocr_time);
    
    create index afc_auto_settlement_ocr_latest_comparison_time_index
       on afc_auto_settlement (ocr_latest_comparison_time);
"""

hil_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)

hil_cursor = hil_cnxn.cursor()
hil_cursor.execute(hil_sql)

hil_cursor.close()
hil_cnxn.close()

afc_cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};', autocommit=True)

afc_cursor = afc_cnxn.cursor()
afc_cursor.execute(afc_sql)

afc_cursor.close()
afc_cnxn.close()