-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
64 lines (45 loc) · 1.53 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
54
55
56
57
58
59
60
61
62
63
64
# coding: utf-8
from sqlalchemy import BigInteger, Column, ForeignKey, Integer, String, Table, Text
from sqlalchemy.orm import relationship
from database import Base
metadata = Base.metadata
class County(Base):
__tablename__ = 'county'
id = Column(Integer, primary_key=True)
state = Column(String)
County_name = Column(String)
FIPS_County = Column(String)
FIPS = Column(String)
FIPS_State = Column(String)
class File(Base):
__tablename__ = 'file'
id = Column(Integer, primary_key=True)
name = Column(String(64))
path = Column(String(128))
class KpiTable(Base):
__tablename__ = 'kpi_table'
id = Column(Integer, primary_key=True)
name = Column(String(64))
description =Column(String(200))
class PercentileRank(Base):
__tablename__ = 'percentile_rank'
id = Column(Integer, primary_key=True)
kpi_table_id = Column(ForeignKey('kpi_table.id'), index=True)
county_id = Column(ForeignKey('county.id'), index=True)
percentage = Column(Integer)
percentile_rank = Column(Integer)
year = Column(Integer)
county = relationship('County')
kpi_table = relationship('KpiTable')
class State(Base):
__tablename__ = 'state'
id = Column(Integer, primary_key=True)
name = Column(String)
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
first_name = Column(String(100))
last_name = Column(String(100))
login = Column(String(80), unique=True)
email = Column(String(120))
password = Column(String(64))