Skip to content

Commit

Permalink
DBT_BQ_MONITORING_GCP_PROJECTS shouldn't be required
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayrnt committed Jan 6, 2025
1 parent 1c1cb6e commit f35fdb7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20250106-153152.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix DBT_BQ_MONITORING_GCP_PROJECTS being required while it should not for region mode
time: 2025-01-06T15:31:52.975763+01:00
custom:
Author: Kayrnt
Issue: ""
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ models:
vars:
# Environment configuration
bq_region: "{{ env_var('DBT_BQ_MONITORING_REGION', 'us') }}"
input_gcp_projects: "{{ env_var('DBT_BQ_MONITORING_GCP_PROJECTS') }}" # example: ['my-gcp-project', 'my-gcp-project2']
input_gcp_projects: "{{ env_var('DBT_BQ_MONITORING_GCP_PROJECTS', '') }}" # example: ['my-gcp-project', 'my-gcp-project2']
# https://cloud.google.com/bigquery/pricing#pricing
# On-demand compute (analysis) pricing
use_flat_pricing: "{{ env_var('DBT_BQ_MONITORING_USE_FLAT_PRICING', true) }}"
Expand Down
10 changes: 7 additions & 3 deletions macros/project_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
{{ return(projects) }}
{#-- check if it's the string and it contains a "," --#}
{% elif projects is string %}
{% set projects_replaced = projects | replace("'", '"') %}
{% set json = fromjson('{"v":' ~ projects_replaced ~ '}') %}
{{ return (json['v']) }}
{% if projects == '' %}
{{ return([]) }}
{% else %}
{% set projects_replaced = projects | replace("'", '"') %}
{% set json = fromjson('{"v":' ~ projects_replaced ~ '}') %}
{{ return (json['v']) }}
{% endif %}
{% else %}
{{ exceptions.raise_compiler_error('Invalid `input_gcp_projects` variables. Got: ' ~ input_gcp_projects ~ ' but expected form like input_gcp_projects = ["project_1", "project_2"] ') }}
{% endif %}
Expand Down

0 comments on commit f35fdb7

Please sign in to comment.