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

Ready for demo #8

Merged
merged 2 commits into from
Jan 5, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env_template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# copy this file to gitignored `.env` and set the environment for your personal workspace

export DBT_DATASET=sandbox_your_name
export DBT_LOCATION=EU
export DBT_PROJECT=some-project-id # must be the GCP project id, not the project name!
export DBT_LOCATION=US # example dataset is in US location
export DBT_PROJECT=some-project-id # must be the GCP project id, not the project name!
25 changes: 13 additions & 12 deletions macros/ensure_target_dataset_exists.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
{% set dataset_name = target.schema %}
{% set dataset_location = target.location %}

{{ print("Ensuring dataset " ~ project_id ~ "." ~ dataset_name ~ " exists in location " ~ dataset_location ) }}
{% if execute %}

{% set create_dataset_query %}
CREATE SCHEMA IF NOT EXISTS `{{ project_id }}`.`{{ dataset_name }}`
OPTIONS (
description = 'Exploring vulnerable PyPI downloads. Managed by https://github.com/brabster/pypi_vulnerabilities',
location = '{{ dataset_location }}',
labels = [('data_classification', 'public')]
)
{% endset %}
{% do log("Ensuring dataset " ~ project_id ~ "." ~ dataset_name ~ " exists in location " ~ dataset_location ) %}

{% if execute %}
{% set results = run_query(create_dataset_query) %}
{% set create_dataset_query %}
CREATE SCHEMA IF NOT EXISTS `{{ project_id }}`.`{{ dataset_name }}`
OPTIONS (
description = 'Exploring vulnerable PyPI downloads. Managed by https://github.com/brabster/pypi_vulnerabilities',
location = '{{ dataset_location }}',
labels = [('data_classification', 'public')]
)
{% endset %}

{% set results = run_query(create_dataset_query) %}
{% endif %}

{% endmacro %}
{% endmacro %}