-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
51 lines (37 loc) · 1.38 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
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, Date, Boolean, BigInteger, Float
from sqlalchemy import create_engine
Base = declarative_base()
class Flow(Base):
__tablename__ = 'flowdata'
id = Column(Integer, primary_key=True) # Will be marked as autoincrement
site = Column(Integer)
amount = Column(Integer)
measuredateyear = Column(Integer)
measuredatemonth = Column(Integer)
measuredateday = Column(Integer)
datapoints = Column(Integer)
average = Column(Boolean, default=False)
class Storage(Base):
__tablename__ = 'storagedata'
id = Column(Integer, primary_key=True) # Will be marked as autoincrement
amount = Column(BigInteger)
measuredateyear = Column(Integer)
measuredatemonth = Column(Integer)
datapoints = Column(Integer)
class Precip(Base):
__tablename__ = 'precipdata'
id = Column(Integer, primary_key=True) # Will be marked as autoincrement
amount = Column(BigInteger)
measuredateyear = Column(Integer)
measuredatemonth = Column(Integer)
datapoints = Column(Integer)
class NDVI(Base):
__tablename__ = 'ndvidata'
id = Column(Integer, primary_key=True) # Will be marked as autoincrement
amount = Column(Float)
measuredateyear = Column(Integer)
measuredatemonth = Column(Integer)
datapoints = Column(Integer)
engine = create_engine('mysql://root:pass1234@localhost/SYDE332')
Base.metadata.create_all(engine)