-
Notifications
You must be signed in to change notification settings - Fork 0
/
dql.py
47 lines (42 loc) · 1.07 KB
/
dql.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
import mysql.connector as myq
from streamlit import caching
def show_r_details(id):
mydb = myq.connect(
host="localhost",
user="root",
password="root"
)
caching.clear_cache()
mycur = mydb.cursor()
mycur.execute("USE COURIER")
arg = tuple([id])
mycur.callproc('show_r', arg)
for result in mycur.stored_results():
res = result.fetchall()
if len(res) != 0:
for row in res:
i = row[0]
o = row[1]
d = row[2]
dt = row[3]
nm = row[4]
ph = row[5]
mycur.close()
mydb.close()
return o, d, dt, nm, ph
def show_c_det():
mydb = myq.connect(
host="localhost",
user="root",
password="root"
)
caching.clear_cache()
mycur = mydb.cursor()
mycur.execute("USE COURIER")
arg = tuple([])
mycur.callproc('show_all_r', arg)
for result in mycur.stored_results():
res = result.fetchall()
mycur.close()
mydb.close()
return res