-
Notifications
You must be signed in to change notification settings - Fork 0
/
ins_r2.py
183 lines (155 loc) · 5.33 KB
/
ins_r2.py
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
import sqlite3
#insert afora
file=open("AFORA.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id_kr,id_tr=line.strip().split('\t')
cursor.execute("INSERT INTO AFORA (ID_Krathshs,ID_Trapeziou) VALUES (?,?)",
(id_kr,id_tr))
conn.commit()
conn.close()
#insert allergies
file=open("ALLERGIA_PROTIMHSEIS.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
sub,id_p=line.strip().split('\t')
cursor.execute("INSERT INTO ALLERGIA_PROTIMHSEIS (Substance,ID_Pelath) VALUES (?,?)",
(sub,id_p))
conn.commit()
conn.close()
#insert diax
file=open("DIAXEIRISTHS.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id_em,start,end,id_x=line.strip().split('\t')
cursor.execute("INSERT INTO DIAXEIRISTHS (ID_Employee,Start_shift,End_shift,ID_Xrhsth) VALUES (?,?,?,?)",
(id_em,start,end,id_x))
conn.commit()
conn.close()
#insert epikoinwnei
file=open("EPIKOINWNEI.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
how,id_d,fnp,lnp,mnp,id_kr=line.strip().split('\t')
cursor.execute("INSERT INTO EPIKOINWNEI (How,ID_Diaxeiristh,Fname_Pelath,Lname_Pelath,MobileNum_Pelath,ID_Krathshs) VALUES (?,?,?,?,?,?)",
(how,id_d,fnp,lnp,mnp,id_kr))
conn.commit()
conn.close()
#insert grafei
file=open("GRAFEI.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
idp,bar_kr,date_rev=line.strip().split('\t')
cursor.execute("INSERT INTO GRAFEI (ID_Pelath,Barcode_Kritikhs,Date_Review) VALUES (?,?,?)",
(idp,bar_kr,date_rev))
conn.commit()
conn.close()
#insert kanei
file=open("KANEI.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
idx,id_kr,date_res=line.strip().split('\t')
cursor.execute("INSERT INTO KANEI (ID_Xrhsth,ID_Krathshs,Date_Reservation) VALUES (?,?,?)",
(idx,id_kr,date_res))
conn.commit()
conn.close()
#insert kratisi
file=open("KRATHSH.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id,name,mn,people,arrival=line.strip().split('\t')
cursor.execute("INSERT INTO KRATHSH (ID,Name,MobileNumber,Num_of_People,Arrival) VALUES (?,?,?,?,?)",
(id,name,mn,people,arrival))
conn.commit()
conn.close()
#insert kritiki
file=open("KRITIKH.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
bar,rate,id_kr,comm=line.strip().split('\t')
cursor.execute("INSERT INTO KRITIKH (Barcode,Rate,ID_Krathshs,Comment) VALUES (?,?,?,?)",
(bar,rate,id_kr,comm))
conn.commit()
conn.close()
#insert protimiseis
file=open("PROTIMHSEIS.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
fav_des,fav_dr,idp=line.strip().split('\t')
cursor.execute("INSERT INTO PROTIMHSEIS (Favorite_Dessert,Favorite_Drink,ID_Pelath) VALUES (?,?,?)",
(fav_des,fav_dr,idp))
conn.commit()
conn.close()
#insert trapezi
file=open("TRAPEZI.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id,cap,px,py,id_x=line.strip().split('\t')
cursor.execute("INSERT INTO TRAPEZI (ID,Capacity,Position_X,Position_Y,ID_Xwrou) VALUES (?,?,?,?,?)",
(id,cap,px,py,id_x))
conn.commit()
conn.close()
#insert xristis
file=open("XRHSTHS.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id,username,password=line.strip().split('\t')
cursor.execute("INSERT INTO XRHSTHS (ID,Username,Password) VALUES (?,?,?)",
(id,username,password))
conn.commit()
conn.close()
#insert xwros
file=open("XWROS.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
id_d,indoors,floor=line.strip().split('\t')
cursor.execute("INSERT INTO XWROS (ID_Department,Indoors,Floor) VALUES (?,?,?)",
(id_d,indoors,floor))
conn.commit()
conn.close()
#insert pelatis-user
file=open("PELATHS_user.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
idx,fname,lname,mn,acode,astreet,anumber,blacklisted=line.strip().split('\t')
cursor.execute("INSERT INTO PELATHS (ID_Xrhsth,Fname,Lname,MobileNum,Address_PostalCode,Address_Street,Address_Number,Blacklisted) VALUES (?,?,?,?,?,?,?,?)",
(idx,fname,lname,mn,acode,astreet,anumber,blacklisted))
conn.commit()
conn.close()
#insert pelatis_nonuser
file=open("PELATHS_user_not.txt", "r")
lines=file.readlines()
conn=sqlite3.connect("r2_noindex.db")
cursor=conn.cursor()
for line in lines:
fname,lname,mn=line.strip().split('\t')
cursor.execute("INSERT INTO PELATHS (Fname,Lname,MobileNum) VALUES (?,?,?)",
(fname,lname,mn))
conn.commit()
conn.close()