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

feat: Onboarding TheLook E-Commerce dataset #294

Merged
merged 22 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0ec7a81
adding thelook_ecommerce dataset for review
alick-at-google Feb 11, 2022
b8ae0c9
adding thelook_ecommerce dataset for review
alick-at-google Feb 11, 2022
fff03a7
Merge branch 'alick-thelook-ecommerce' of https://github.com/alick-at…
alick-at-google Feb 11, 2022
a8614cf
feat: fix conventional commits
alick-at-google Feb 11, 2022
8be4a53
feat: update e-commerce dataset pipeline
alick-at-google Feb 17, 2022
a132b45
feat: fix linting errors
alick-at-google Feb 17, 2022
fa2b1f2
feat: fix linting in fake.py
alick-at-google Feb 17, 2022
1330031
feat: update generator from code review #1
alick-at-google Feb 18, 2022
cada092
feat: remove unused comment
alick-at-google Feb 18, 2022
27e3891
feat: update import statements for isort
alick-at-google Feb 18, 2022
6016558
feat: update import and regen dag
alick-at-google Feb 22, 2022
33b1801
feat: updates from code review
alick-at-google Feb 23, 2022
91e738b
feat: update flake8 linting issue
alick-at-google Feb 24, 2022
b5f32c6
Update datasets/thelook_ecommerce/pipelines/thelook_ecommerce/pipelin…
adlersantos Feb 25, 2022
8d7a3ba
Update datasets/thelook_ecommerce/pipelines/thelook_ecommerce/pipelin…
adlersantos Feb 25, 2022
40936c5
Update datasets/thelook_ecommerce/pipelines/dataset.yaml
adlersantos Feb 25, 2022
bd80e17
cleanup: removed trailing whitespace
adlersantos Feb 25, 2022
86f1bd2
fix: make the DAG work
adlersantos Feb 25, 2022
32cd39f
Merge branch 'main' into alick-thelook-ecommerce
adlersantos Feb 25, 2022
cb45d63
cleanup: set num users to 15k
adlersantos Feb 26, 2022
6e69807
fix: update users email and table descriptions
alick-at-google Feb 26, 2022
73c1443
cleanup: Emphasize that the data is synthetic (fictitious)
adlersantos Feb 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions datasets/thelook_ecommerce/infra/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* 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.
*/


provider "google" {
project = var.project_id
impersonate_service_account = var.impersonating_acct
region = var.region
}

data "google_client_openid_userinfo" "me" {}

output "impersonating-account" {
value = data.google_client_openid_userinfo.me.email
}
26 changes: 26 additions & 0 deletions datasets/thelook_ecommerce/infra/thelook_ecommerce_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" "thelook_ecommerce" {
dataset_id = "thelook_ecommerce"
project = var.project_id
description = "Fictitious E-Commerce Dataset"
}

output "bigquery_dataset-thelook_ecommerce-dataset_id" {
value = google_bigquery_dataset.thelook_ecommerce.dataset_id
}
142 changes: 142 additions & 0 deletions datasets/thelook_ecommerce/infra/thelook_ecommerce_pipeline.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/**
* 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_table" "thelook_ecommerce_products" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "products"
description = "The Look fictitious e-commerce dataset - products table"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_products-table_id" {
value = google_bigquery_table.thelook_ecommerce_products.table_id
}

output "bigquery_table-thelook_ecommerce_products-id" {
value = google_bigquery_table.thelook_ecommerce_products.id
}

resource "google_bigquery_table" "thelook_ecommerce_events" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "events"
description = "Programatically generated web events for The Look fictitious e-commerce store"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_events-table_id" {
value = google_bigquery_table.thelook_ecommerce_events.table_id
}

output "bigquery_table-thelook_ecommerce_events-id" {
value = google_bigquery_table.thelook_ecommerce_events.id
}

resource "google_bigquery_table" "thelook_ecommerce_users" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "users"
description = "Programatically generated users for The Look fictitious e-commerce store"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_users-table_id" {
value = google_bigquery_table.thelook_ecommerce_users.table_id
}

output "bigquery_table-thelook_ecommerce_users-id" {
value = google_bigquery_table.thelook_ecommerce_users.id
}

resource "google_bigquery_table" "thelook_ecommerce_orders" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "orders"
description = "Programatically generated orders for The Look fictitious e-commerce store"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_orders-table_id" {
value = google_bigquery_table.thelook_ecommerce_orders.table_id
}

output "bigquery_table-thelook_ecommerce_orders-id" {
value = google_bigquery_table.thelook_ecommerce_orders.id
}

resource "google_bigquery_table" "thelook_ecommerce_order_items" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "order_items"
description = "Programatically generated order items for The Look fictitious e-commerce store"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_order_items-table_id" {
value = google_bigquery_table.thelook_ecommerce_order_items.table_id
}

output "bigquery_table-thelook_ecommerce_order_items-id" {
value = google_bigquery_table.thelook_ecommerce_order_items.id
}

resource "google_bigquery_table" "thelook_ecommerce_inventory_items" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "inventory_items"
description = "Programatically generated inventory for The Look fictitious e-commerce store"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_inventory_items-table_id" {
value = google_bigquery_table.thelook_ecommerce_inventory_items.table_id
}

output "bigquery_table-thelook_ecommerce_inventory_items-id" {
value = google_bigquery_table.thelook_ecommerce_inventory_items.id
}

resource "google_bigquery_table" "thelook_ecommerce_distribution_centers" {
project = var.project_id
dataset_id = "thelook_ecommerce"
table_id = "distribution_centers"
description = "The Look fictitious e-commerce dataset: distribution_centers table"
depends_on = [
google_bigquery_dataset.thelook_ecommerce
]
}

output "bigquery_table-thelook_ecommerce_distribution_centers-table_id" {
value = google_bigquery_table.thelook_ecommerce_distribution_centers.table_id
}

output "bigquery_table-thelook_ecommerce_distribution_centers-id" {
value = google_bigquery_table.thelook_ecommerce_distribution_centers.id
}
23 changes: 23 additions & 0 deletions datasets/thelook_ecommerce/infra/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* 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.
*/


variable "project_id" {}
variable "bucket_name_prefix" {}
variable "impersonating_acct" {}
variable "region" {}
variable "env" {}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.8

# Allow statements and log messages to appear in Cloud logs
ENV PYTHONUNBUFFERED True
# ENV service_account_key_path="my-personal-instance-2c2c15d75117.json"

# Copy the requirements file into the image
COPY requirements.txt ./

# Install the packages specified in the requirements file
RUN python3 -m pip install --no-cache-dir -r requirements.txt

# The WORKDIR instruction sets the working directory for any RUN, CMD,
# ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.
# If the WORKDIR doesn’t exist, it will be created even if it’s not used in
# any subsequent Dockerfile instruction
WORKDIR /custom

# Copy the specific data processing script/s in the image under /custom/*
COPY ./fake.py .
COPY ./helper ./data

# Command to run the data processing script when the container is run
CMD ["python3", "fake.py"]
Loading