mssql_script3.py
4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import pyodbc
hil_sql = """
create table hil_ocr_report
(
id bigint identity
primary key,
case_number nvarchar(64) not null,
request_team tinyint default 0 not null,
request_trigger tinyint default 0 not null,
input_file nvarchar(255) not null,
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason tinyint,
process_name tinyint default 0 not null,
total_fields smallint,
workflow_name tinyint
);
create index hil_ocr_report_transaction_start_index
on hil_ocr_report (transaction_start);
create table hil_compare_report
(
id bigint identity
primary key,
case_number nvarchar(64) not null,
request_team tinyint default 0 not null,
request_trigger tinyint default 4 not null,
input_file nvarchar(255),
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason nvarchar(max),
process_name tinyint default 4 not null,
total_fields smallint,
workflow_name nvarchar(255)
);
create index hil_compare_report_transaction_start_index
on hil_compare_report (transaction_start);
create table hil_compare_offline_report
(
id bigint identity
primary key,
case_number nvarchar(255) not null,
request_team nvarchar(255) not null,
request_trigger nvarchar(1024) not null,
input_file nvarchar(2048) not null,
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason nvarchar(max),
process_name nvarchar(1024) not null,
total_fields smallint,
workflow_name nvarchar(1024) not null,
);
create index hil_compare_offline_report_transaction_start_index
on hil_compare_offline_report (transaction_start);
"""
afc_sql = """
create table afc_ocr_report
(
id bigint identity
primary key,
case_number nvarchar(64) not null,
request_team tinyint default 0 not null,
request_trigger tinyint default 0 not null,
input_file nvarchar(255) not null,
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason tinyint,
process_name tinyint default 0 not null,
total_fields smallint,
workflow_name tinyint
);
create index afc_ocr_report_transaction_start_index
on afc_ocr_report (transaction_start);
create table afc_compare_report
(
id bigint identity
primary key,
case_number nvarchar(64) not null,
request_team tinyint default 0 not null,
request_trigger tinyint default 4 not null,
input_file nvarchar(255),
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason nvarchar(max),
process_name tinyint default 4 not null,
total_fields smallint,
workflow_name nvarchar(255)
);
create index afc_compare_report_transaction_start_index
on afc_compare_report (transaction_start);
create table afc_compare_offline_report
(
id bigint identity
primary key,
case_number nvarchar(255) not null,
request_team nvarchar(255) not null,
request_trigger nvarchar(1024) not null,
input_file nvarchar(2048) not null,
transaction_start datetime not null,
transaction_end datetime not null,
successful_at_this_level bit default 0 not null,
failure_reason nvarchar(max),
process_name nvarchar(1024) not null,
total_fields smallint,
workflow_name nvarchar(1024) not null,
);
create index afc_compare_offline_report_transaction_start_index
on afc_compare_offline_report (transaction_start);
"""
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()