-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
53 lines (37 loc) · 1.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
from peewee import *
import utils
db_path = os.path.join(utils.get_code_dir(), "data.db")
db = SqliteDatabase(db_path)
# db = PostgresqlDatabase(
# database='',
# user='',
# password='',
# host='',
# port=)
class BaseModel(Model):
class Meta:
database = db
class Subject(BaseModel):
id_str = CharField(index=True, unique=True)
screen_name = CharField(index=True, unique=True)
class Follower(BaseModel):
id_str = CharField(index=True, unique=True)
botometer = FloatField(index=True, null=True)
class Relationship(BaseModel):
subject = ForeignKeyField(Subject, index=True)
follower = ForeignKeyField(Follower, index=True)
class Meta:
indexes = ((('subject', 'follower'), True), )
class Quality_Report(BaseModel):
subject = ForeignKeyField(Subject, index=True)
epoch_time = IntegerField(index=True)
total = IntegerField()
very_good = IntegerField()
good = IntegerField()
neutral = IntegerField()
poor = IntegerField()
very_poor = IntegerField()
no_timeline = IntegerField()
protected = IntegerField()
db.create_tables([Subject, Follower, Relationship, Quality_Report])