-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
38 lines (32 loc) · 1.11 KB
/
models.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
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
from sqlalchemy import Column, Integer, String, ForeignKey
class User(Base):
__tablename__ = 'User'
user_id = Column(String, primary_key=True)
team_name = Column(Integer)
def __repr__(self):
return "<User(id='%s', team_name='%s')>" % (
self.user_id, self.team_name)
class Answer(Base):
__tablename__ = 'Answer'
user_id = Column(String)
question_id = Column(Integer)
answer = Column(Integer)
id = Column(Integer, primary_key=True)
def __repr__(self):
return "<Answer(id='%s', question_id='%s')>" % (
self.user_id, self.question_id)
class Question(Base):
__tablename__ = 'Question'
question_id = Column(Integer, primary_key=True)
meta = Column(String)
media = Column(String)
answer = Column(Integer)
choice1 = Column(String)
choice2 = Column(String)
choice3 = Column(String)
choice4 = Column(String)
def __repr__(self):
return "<Question(id='%s', answer='%s')>" % (
self.question_id, self.answer)