mssql_script20.py 1.03 KB
import pyodbc

hil_sql = """
    create table generic_ocr_report
    (
       id bigint identity primary key,
       status bit default 1 not null,
       duration smallint,
       create_time datetime not null
    );

    ALTER TABLE mpos_report ADD source tinyint default 0 not null;
"""

afc_sql = """
    create table afc_offline_report
    (
       id bigint identity primary key,
       input_folder nvarchar(512) not null,
       doc_type tinyint default 0 not null,
       file_name nvarchar(1024) not null,
       status bit default 1 not null,
       failure_reason tinyint default 0 not null,
       duration smallint not null,
       create_time datetime not null
    );
"""

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