Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Renamed dataset from sunroof to sunroof_solar #226

Merged
merged 2 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 0 additions & 26 deletions datasets/sunroof/_terraform/sunroof_dataset.tf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
*/


resource "google_bigquery_table" "solar_potential_by_census_tract" {
resource "google_bigquery_table" "sunroof_solar_solar_potential_by_censustract" {
project = var.project_id
dataset_id = "sunroof"
table_id = "solar_potential_by_census_tract"
dataset_id = "sunroof_solar"
table_id = "solar_potential_by_censustract"

description = "Sunroof Solar Potential By Census Tract"




depends_on = [
google_bigquery_dataset.sunroof
google_bigquery_dataset.sunroof_solar
]
}

output "bigquery_table-solar_potential_by_census_tract-table_id" {
value = google_bigquery_table.solar_potential_by_census_tract.table_id
output "bigquery_table-sunroof_solar_solar_potential_by_censustract-table_id" {
value = google_bigquery_table.sunroof_solar_solar_potential_by_censustract.table_id
}

output "bigquery_table-solar_potential_by_census_tract-id" {
value = google_bigquery_table.solar_potential_by_census_tract.id
output "bigquery_table-sunroof_solar_solar_potential_by_censustract-id" {
value = google_bigquery_table.sunroof_solar_solar_potential_by_censustract.id
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/


resource "google_bigquery_table" "solar_potential_by_postal_code" {
resource "google_bigquery_table" "sunroof_solar_solar_potential_by_postal_code" {
project = var.project_id
dataset_id = "sunroof"
dataset_id = "sunroof_solar"
table_id = "solar_potential_by_postal_code"

description = "Sunroof Solar Potential By Postal Code"
Expand All @@ -26,14 +26,14 @@ resource "google_bigquery_table" "solar_potential_by_postal_code" {


depends_on = [
google_bigquery_dataset.sunroof
google_bigquery_dataset.sunroof_solar
]
}

output "bigquery_table-solar_potential_by_postal_code-table_id" {
value = google_bigquery_table.solar_potential_by_postal_code.table_id
output "bigquery_table-sunroof_solar_solar_potential_by_postal_code-table_id" {
value = google_bigquery_table.sunroof_solar_solar_potential_by_postal_code.table_id
}

output "bigquery_table-solar_potential_by_postal_code-id" {
value = google_bigquery_table.solar_potential_by_postal_code.id
output "bigquery_table-sunroof_solar_solar_potential_by_postal_code-id" {
value = google_bigquery_table.sunroof_solar_solar_potential_by_postal_code.id
}
26 changes: 26 additions & 0 deletions datasets/sunroof_solar/_terraform/sunroof_solar_dataset.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


resource "google_bigquery_dataset" "sunroof_solar" {
dataset_id = "sunroof_solar"
project = var.project_id
description = "Project Sunroof computes how much sunlight hits your roof in a year. Solar viability is determined using a methodology found here: https://www.google.com/get/sunroof/data-explorer/data-explorer-methodology.pdf The use of this data is subject to Google\u0027s Terms of Service. Feel free to include this data from Project Sunroof in other analyses, materials, reports, and communications with the following attribution: Source: Google Project Sunroof data explorer (August 2017)."
}

output "bigquery_dataset-sunroof_solar-dataset_id" {
value = google_bigquery_dataset.sunroof_solar.dataset_id
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# limitations under the License.

dataset:
name: sunroof
friendly_name: sunroof
description: sunroof
name: sunroof_solar
friendly_name: sunroof_solar
description: sunroof_solar
dataset_sources: ~
terms_of_use: ~


resources:
- type: bigquery_dataset
dataset_id: sunroof
description: sunroof
dataset_id: sunroof_solar
description: |-
Project Sunroof computes how much sunlight hits your roof in a year. Solar viability is determined using a methodology found here: https://www.google.com/get/sunroof/data-explorer/data-explorer-methodology.pdf The use of this data is subject to Google's Terms of Service. Feel free to include this data from Project Sunroof in other analyses, materials, reports, and communications with the following attribution: Source: Google Project Sunroof data explorer (August 2017).
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
resources:

- type: bigquery_table
table_id: "solar_potential_by_census_tract"
table_id: "solar_potential_by_censustract"
description: "Sunroof Solar Potential By Census Tract"

dag:
airflow_version: 2
initialize:
dag_id: solar_potential_by_census_tract
dag_id: solar_potential_by_censustract
default_args:
owner: "Google"
depends_on_past: False
Expand All @@ -40,7 +40,7 @@ dag:
args:

task_id: "transform_csv"
name: "solar_potential_by_census_tract"
name: "solar_potential_by_censustract"
namespace: "default"
affinity:
nodeAffinity:
Expand All @@ -52,27 +52,27 @@ dag:
values:
- "pool-e2-standard-4"
image_pull_policy: "Always"
image: "{{ var.json.sunroof.container_registry.run_csv_transform_kub }}"
image: "{{ var.json.sunroof_solar.container_registry.run_csv_transform_kub }}"
env_vars:
SOURCE_URL: "gs://project-sunroof/csv/latest/project-sunroof-census_tract.csv"
SOURCE_FILE: "files/data.csv"
TARGET_FILE: "files/data_output.csv"
CHUNKSIZE: "750000"
TARGET_GCS_BUCKET: "{{ var.value.composer_bucket }}"
TARGET_GCS_PATH: "data/sunroof/solar_potential_by_census_tract/data_output.csv"
TARGET_GCS_PATH: "data/sunroof/solar_potential_by_censustract/data_output.csv"
resources:
limit_memory: "8G"
limit_cpu: "3"

- operator: "GoogleCloudStorageToBigQueryOperator"
description: "Task to load CSV data to a BigQuery table"
description: "Load CSV data to a BigQuery table"

args:
task_id: "load_to_bq"
bucket: "{{ var.value.composer_bucket }}"
source_objects: ["data/sunroof/solar_potential_by_census_tract/data_output.csv"]
source_objects: ["data/sunroof/solar_potential_by_censustract/data_output.csv"]
source_format: "CSV"
destination_project_dataset_table: "sunroof.solar_potential_by_census_tract"
destination_project_dataset_table: "sunroof.solar_potential_by_censustract"
skip_leading_rows: 1
allow_quoted_newlines: True
write_disposition: "WRITE_TRUNCATE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


with DAG(
dag_id="sunroof.solar_potential_by_census_tract",
dag_id="sunroof_solar.solar_potential_by_censustract",
default_args=default_args,
max_active_runs=1,
schedule_interval="@daily",
Expand All @@ -36,7 +36,7 @@
# Run CSV transform within kubernetes pod
transform_csv = kubernetes_pod.KubernetesPodOperator(
task_id="transform_csv",
name="solar_potential_by_census_tract",
name="solar_potential_by_censustract",
namespace="default",
affinity={
"nodeAffinity": {
Expand All @@ -56,14 +56,14 @@
}
},
image_pull_policy="Always",
image="{{ var.json.sunroof.container_registry.run_csv_transform_kub }}",
image="{{ var.json.sunroof_solar.container_registry.run_csv_transform_kub }}",
env_vars={
"SOURCE_URL": "gs://project-sunroof/csv/latest/project-sunroof-census_tract.csv",
"SOURCE_FILE": "files/data.csv",
"TARGET_FILE": "files/data_output.csv",
"CHUNKSIZE": "750000",
"TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
"TARGET_GCS_PATH": "data/sunroof/solar_potential_by_census_tract/data_output.csv",
"TARGET_GCS_PATH": "data/sunroof/solar_potential_by_censustract/data_output.csv",
},
resources={"limit_memory": "8G", "limit_cpu": "3"},
)
Expand All @@ -72,9 +72,9 @@
load_to_bq = gcs_to_bigquery.GCSToBigQueryOperator(
task_id="load_to_bq",
bucket="{{ var.value.composer_bucket }}",
source_objects=["data/sunroof/solar_potential_by_census_tract/data_output.csv"],
source_objects=["data/sunroof/solar_potential_by_censustract/data_output.csv"],
source_format="CSV",
destination_project_dataset_table="sunroof.solar_potential_by_census_tract",
destination_project_dataset_table="sunroof.solar_potential_by_censustract",
skip_leading_rows=1,
allow_quoted_newlines=True,
write_disposition="WRITE_TRUNCATE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dag:
values:
- "pool-e2-standard-4"
image_pull_policy: "Always"
image: "{{ var.json.sunroof.container_registry.run_csv_transform_kub }}"
image: "{{ var.json.sunroof_solar.container_registry.run_csv_transform_kub }}"
env_vars:
SOURCE_URL: "gs://project-sunroof/csv/latest/project-sunroof-postal_code.csv"
SOURCE_FILE: "files/data.csv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


with DAG(
dag_id="sunroof.solar_potential_by_postal_code",
dag_id="sunroof_solar.solar_potential_by_postal_code",
default_args=default_args,
max_active_runs=1,
schedule_interval="@daily",
Expand Down Expand Up @@ -56,7 +56,7 @@
}
},
image_pull_policy="Always",
image="{{ var.json.sunroof.container_registry.run_csv_transform_kub }}",
image="{{ var.json.sunroof_solar.container_registry.run_csv_transform_kub }}",
env_vars={
"SOURCE_URL": "gs://project-sunroof/csv/latest/project-sunroof-postal_code.csv",
"SOURCE_FILE": "files/data.csv",
Expand Down