-
Notifications
You must be signed in to change notification settings - Fork 1
/
FillDataBaseScript.py
executable file
·68 lines (61 loc) · 2.19 KB
/
FillDataBaseScript.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
#!/usr/bin/python3
"""
testing to create template data in
trashpanda database
@Serhii Riznychuk
"""
import static.configs.EnvConf
from static.classes.datacontroller.TableFillController import TableFillController
from static.classes.datacontroller.SQLController import SQLCloud
from static.tool.console.vt1000 import getTerminalSize as gts
from static.tool.console.vt1000 import ForeGround as fg, FormatCode as cd, BackGround as bg
import sys
from os import system
# get terminal column size
_ , _columns = gts()
sqlController = SQLCloud.getInstance()
tables = [key for key in sqlController.DBRepr]
toChose = list(zip([x for x in range(len(tables))], tables))
cursorUsers = TableFillController(database="test_cloud", tablename="users")
# cursorUsers.fill(record_count=1000)
while(True):
system("clear")
print(bg.green + fg.white + "{:^{x}}".format("", x=_columns) + cd.reset)
print(bg.green+cd.bold+fg.white+"{:^{x}}".format(" Field Pole ", x=_columns)+cd.reset)
print(bg.green + fg.white + "{:^{x}}".format("", x=_columns) + cd.reset)
print("")
second = int(int(_columns) / 2)
first = int(_columns) - second
column = lambda text: bg.black+fg.white+str(text)+cd.reset
print("\n\n".join([ ("{:>{x}} | {:<{a}}".format( "Item: "+str(number), column(tablename), x=first, a=second)) for number, tablename in toChose]))
print()
print( "{:-^{x}}".format("", x=_columns))
num = 0
try:
num = input("Please write column NUMER >> ")
except KeyboardInterrupt:
print("\nbye!")
exit(0)
except:
print("\nbye!")
exit(0)
cursor = TableFillController(database="test_cloud", tablename=toChose[int(num)][1])
print("{:^{x}}".format(" META ", x=_columns))
print()
print(cursor.printMetaColumnTemplate())
print()
print("{:^{x}}".format(" LAMBDA ", x=_columns))
print()
cursor.printLambdaColumnTemplate()
print()
print("{:^{x}}".format(" SQL-FILL ", x=_columns))
count = 0
try:
count = input("Please write count of fils >> ")
except KeyboardInterrupt:
print("\nbye!")
break
if count == 0:
break
cursor.fill(record_count=int(count))
input(">> PRESS ANY KEY <<")