mssql_script4.py
2 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
import pyodbc
hil_sql = """
create table dda_records
(
id bigint identity
primary key,
application_id nvarchar(64) not null,
is_dda_found bit default 0 not null,
is_id_found bit default 0 not null,
is_bc_found bit default 0 not null,
all_found bit default 0 not null,
dda_path nvarchar(1024),
id_path nvarchar(1024),
bc_path nvarchar(1024),
customer_name nvarchar(1024),
customer_id nvarchar(1024),
account_id nvarchar(1024),
dda_found_time datetime,
id_found_time datetime,
bc_found_time datetime,
update_time datetime not null,
create_time datetime not null,
);
create index dda_records_application_id_index
on dda_records (application_id);
create index dda_records_update_time_index
on dda_records (update_time);
create index dda_records_create_time_index
on dda_records (create_time);
create table idbc_records
(
id bigint identity
primary key,
application_id nvarchar(64) not null,
target_name nvarchar(1024),
target_id nvarchar(1024) not null,
is_id bit default 1 not null,
file_path nvarchar(1024) not null,
create_time datetime not null,
);
create index idbc_records_application_id_index
on idbc_records (application_id);
create index idbc_records_application_id_target_name_index
on idbc_records (application_id, target_name);
create index idbc_records_application_id_target_id_index
on idbc_records (application_id, target_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()