-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.py
30 lines (26 loc) · 1.39 KB
/
schema.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
# Importing required packages
from google.cloud import bigquery
# Defining schemas for our 3 tables on BigQuery
# DataFrames that will be loaded into these tables will adhere to their respective schemas
forecast_2hr_schema = [
bigquery.SchemaField('area', 'STRING', mode='REQUIRED'),
bigquery.SchemaField('latitude', 'FLOAT64', mode='REQUIRED'),
bigquery.SchemaField('longitude', 'FLOAT64', mode='REQUIRED'),
bigquery.SchemaField('forecast_2hr', 'STRING', mode='NULLABLE'),
bigquery.SchemaField('fetch_time', 'DATETIME', mode='REQUIRED'),
]
forecast_24hr_general_schema = [
bigquery.SchemaField('forecast_24hr', 'STRING', mode='NULLABLE'),
bigquery.SchemaField('relative_humidity_low', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('relative_humidity_high', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('temperature_low', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('temperature_high', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('wind_speed_low', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('wind_speed_high', 'FLOAT64', mode='NULLABLE'),
bigquery.SchemaField('fetch_time', 'DATETIME', mode='REQUIRED'),
]
forecast_24hr_region_schema = [
bigquery.SchemaField('area', 'STRING', mode='REQUIRED'),
bigquery.SchemaField('forecast_24hr', 'STRING', mode='NULLABLE'),
bigquery.SchemaField('fetch_time', 'DATETIME', mode='REQUIRED'),
]