-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_tables.py
68 lines (61 loc) · 2.8 KB
/
create_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
from database_connect import connect
from sqlalchemy import Table, Column, Integer, String, Numeric, DateTime, Text
from geoalchemy2 import Geometry
from config_methods import config_section_map
db_user = config_section_map('database')['user']
db_password = config_section_map('database')['password']
db_name = config_section_map('database')['database']
db_host = config_section_map('database')['host']
db_port = config_section_map('database')['port']
def create_table():
con, meta = connect(db_user, db_password, db_name, db_host, db_port)
fire = Table('fires', meta,
Column('id', Integer, primary_key=True),
Column('scrape_date', DateTime),
Column('source', String),
Column('lat', Numeric),
Column('lon', Numeric),
Column('name', String),
Column('acres', Numeric),
Column('published_date', DateTime),
Column('start_date', String),
Column('last_updated', DateTime),
Column('summary', Text),
Column('remarks', Text),
Column('location_description', Text),
Column('containment', String),
Column('estimated_contained_date', DateTime),
Column('ros', String),
Column('roc', String),
Column('alternate_name', String),
Column('country', String),
Column('state', String),
Column('city', String),
Column('region', String),
Column('county', String),
Column('fire_number', String),
Column('initial_attack_acres', Numeric),
Column('fuel_type', String),
Column('conditions', String),
Column('land_owner', String),
Column('life_threatened', String),
Column('structures_threatened', String),
Column('structures_destroyed', String),
Column('road_closures', String),
Column('evacuations', String),
Column('special_hazards', String),
Column('injuries_reported', String),
Column('details_summary', Text),
Column('incident_commander', String),
Column('type', String),
Column('planned_actions', Text),
Column('source_url', String),
Column('irwin_id', String),
Column('inciweb_id', Integer),
Column('calfire_id', Integer),
Column('description', Text),
Column('hashtag', String),
Column('geom', Geometry('POINT', 4326), index=True)
)
meta.create_all(con)
create_table()