-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLighter.py
More file actions
65 lines (52 loc) · 1.62 KB
/
SQLighter.py
File metadata and controls
65 lines (52 loc) · 1.62 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
import sqlite3
conn = sqlite3.connect('database.db', check_same_thread=False)
cursor = conn.cursor()
# def db_table_val(user_id: int, user_name: str, user_surname: str, username: str):
# cursor.execute('INSERT INTO answers (user_id, Goodway, CleanShowroom, WaitingQueueTerminal,WaitingQueueDispatcher,CleanWaitingQueue) VALUES (?, ?, ?, ?, ?, ?, ?)', (user_id, Goodway, CleanShowroom, WaitingQueueTerminal,WaitingQueueDispatcher,CleanWaitingQueue))
# conn.commit()
def db_admin_init(conn, adminslist):
"""
create table with admin list
:param conn: sql connection cursor
:param adminslist: telegram's id of admins
:return:
"""
cursor.execute('CREATE TABLE "admins" ( \
"id" INTEGER UNIQUE, \
"admin_id" INTEGER, \
PRIMARY KEY("id") );')
conn.commit()
defadmins = adminslist
for adid in defadmins:
cursor.execute(
'INSERT INTO admins (admin_id) VALUES (%s)' % adid)
conn.commit()
"""
Initialize SQL-queary table
"""
AnswerTableQuery = """CREATE TABLE "answers" (
"id" INTEGER NOT NULL,
"user_name" TEXT,
"user_surname" TEXT,
"username" TEXT,
"user_id" INTEGER,
"Goodway" TEXT,
"CleanShowroom" TEXT,
"WaitingQueueTerminal" TEXT,
"WaitingQueueDispatcher" TEXT,
"CleanWaitingQueue" TEXT,
"datetime" TEXT,
"ShowRoomPhoto" INTEGER,
"WaitingQueuePhoto" INTEGER,
PRIMARY KEY("id" AUTOINCREMENT)
);"""
# AnswerTableQuery = """CREATE TABLE "answers" (
# "id" INTEGER NOT NULL,
# "user_id" INTEGER,
# "Goodway" INTEGER,
# "CleanShowroom" INTEGER,
# "WaitingQueueTerminal" INTEGER,
# "WaitingQueueDispatcher" INTEGER,
# "CleanWaitingQueue" INTEGER,
# PRIMARY KEY("id" AUTOINCREMENT)
# )"""