-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdropdown_tables.py
86 lines (65 loc) · 2.15 KB
/
dropdown_tables.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
from sqlalchemy import *
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
engine = create_engine('sqlite:///dropdowns.db', echo=True)
Base = declarative_base()
def convert_str(query):
result = []
for item in query:
item = str(item)
result.append(item.strip(")").strip("(").strip(",").strip("'"))
return sorted(result)
########################################################################
class Drop_test(Base):
""""""
__tablename__ = "dropdown_test"
id = Column(Integer, primary_key=True)
test = Column(String)
#----------------------------------------------------------------------
def __init__(self, test):
""""""
self.test = test
class Drop_post(Base):
""""""
__tablename__ = "dropdown_post"
id = Column(Integer, primary_key=True)
post = Column(String)
#----------------------------------------------------------------------
def __init__(self, post):
""""""
self.post = post
class Drop_fab(Base):
""""""
__tablename__ = "dropdown_fab"
id = Column(Integer, primary_key=True)
fab = Column(String)
#----------------------------------------------------------------------
def __init__(self, fab):
""""""
self.fab = fab
class Drop_ped(Base):
""""""
__tablename__ = "dropdown_ped"
id = Column(Integer, primary_key=True)
ped = Column(String)
#----------------------------------------------------------------------
def __init__(self, ped):
""""""
self.ped = ped
class User(Base):
""""""
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String)
password = Column(String)
admin = Column(BOOLEAN)
#----------------------------------------------------------------------
def __init__(self, username, password, admin):
""""""
self.username = username
self.password = password
self.admin = admin
# create tables
Base.metadata.create_all(engine)