mssql_script13.py 2.22 KB
import pyodbc

hil_sql = """
    create table hil_auto_settlement
    (
       id bigint identity primary key,
       application_id nvarchar(64) not null,
       aa_type nvarchar(64),
       
       rpa_result smallint,
       rpa_1st_eye_tat decimal(18,0),
       rpa_2nd_eye_tat decimal(18,0),
       rpa_3rd_eye_tat decimal(18,0),
       rpa_total_tat decimal(18,0),
       rpa_activated_time datetime,
       rpa_get_case_from_ocr_time datetime,
       rpa_get_case_from_oc_time datetime,
       rpa_payment_authorize_time datetime,
       rpa_second_eye_time datetime,
       
       on_off bit default 1 not null,
       ocr_auto_result_pass bit default 0 not null,
       ocr_auto_result nvarchar(max),
       ocr_latest_comparison_time datetime,
       
       update_time datetime not null,
       create_time datetime not null
    );
    
    create index hil_auto_settlement_application_id_index
       on hil_auto_settlement (application_id);
"""

afc_sql = """
    create table afc_auto_settlement
    (
       id bigint identity primary key,
       application_id nvarchar(64) not null,
       aa_type nvarchar(64),
       
       rpa_result smallint,
       rpa_1st_eye_tat decimal(18,0),
       rpa_2nd_eye_tat decimal(18,0),
       rpa_3rd_eye_tat decimal(18,0),
       rpa_total_tat decimal(18,0),
       rpa_activated_time datetime,
       rpa_get_case_from_ocr_time datetime,
       rpa_get_case_from_oc_time datetime,
       rpa_payment_authorize_time datetime,
       rpa_second_eye_time datetime,
       
       on_off bit default 1 not null,
       ocr_auto_result_pass bit default 0 not null,
       ocr_auto_result nvarchar(max),
       ocr_latest_comparison_time datetime,
       
       update_time datetime not null,
       create_time datetime not null
    );
    
    create index afc_auto_settlement_application_id_index
       on afc_auto_settlement (application_id);
"""

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()