Skip to content

Commit

Permalink
clean 'No datasets found in the project list' log
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayrnt committed Oct 19, 2024
1 parent 9866934 commit d293ac1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241019-225638.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: clean "No datasets found in the project list" log
time: 2024-10-19T22:56:38.765209+02:00
custom:
Author: Kayrnt
Issue: "35"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{# More details about base table in https://cloud.google.com/bigquery/docs/information-schema-constraint-column-usage -#}


{% set preflight_sql -%}
{% if project_list()|length > 0 -%}
{% for project in project_list() -%}
Expand All @@ -17,9 +17,6 @@
{%- endset %}
{% set results = run_query(preflight_sql) %}
{% set dataset_list = results | map(attribute='SCHEMA_NAME') | list %}
{%- if dataset_list | length == 0 -%}
{{ log("No datasets found in the project list", info=True) }}
{%- endif -%}

Check failure on line 20 in models/base/google/tables/information_schema_constraint_column_usage.sql

View workflow job for this annotation

GitHub Actions / SQLFluff Lint

SQLFluff

LT01: Unnecessary trailing whitespace.
WITH base AS (
{%- if dataset_list | length == 0 -%}
Expand All @@ -39,7 +36,7 @@ constraint_name
{% if not loop.last %}UNION ALL{% endif %}
{% endfor %}
{%- endif -%}



)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{# More details about base table in https://cloud.google.com/bigquery/docs/information-schema-key-column-usage -#}


{% set preflight_sql -%}
{% if project_list()|length > 0 -%}
{% for project in project_list() -%}
Expand All @@ -17,10 +17,7 @@
{%- endset %}
{% set results = run_query(preflight_sql) %}
{% set dataset_list = results | map(attribute='SCHEMA_NAME') | list %}
{%- if dataset_list | length == 0 -%}
{{ log("No datasets found in the project list", info=True) }}
{%- endif -%}


WITH base AS (
{%- if dataset_list | length == 0 -%}
SELECT CAST(NULL AS STRING) AS constraint_catalog, CAST(NULL AS STRING) AS constraint_schema, CAST(NULL AS STRING) AS constraint_name, CAST(NULL AS STRING) AS table_catalog, CAST(NULL AS STRING) AS table_schema, CAST(NULL AS STRING) AS table_name, CAST(NULL AS STRING) AS column_name, CAST(NULL AS INT64) AS ordinal_position, CAST(NULL AS INT64) AS position_in_unique_constraint
Expand All @@ -41,7 +38,7 @@ position_in_unique_constraint
{% if not loop.last %}UNION ALL{% endif %}
{% endfor %}
{%- endif -%}



)
Expand Down
7 changes: 2 additions & 5 deletions models/base/google/tables/information_schema_partitions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ roles/bigquery.dataViewer
For more information about BigQuery permissions, see
Access control with IAM. -#}


{% set preflight_sql -%}
{% if project_list()|length > 0 -%}
{% for project in project_list() -%}
Expand All @@ -29,9 +29,6 @@ Access control with IAM. -#}
{%- endset %}
{% set results = run_query(preflight_sql) %}
{% set dataset_list = results | map(attribute='SCHEMA_NAME') | list %}
{%- if dataset_list | length == 0 -%}
{{ log("No datasets found in the project list", info=True) }}
{%- endif -%}

Check failure on line 32 in models/base/google/tables/information_schema_partitions.sql

View workflow job for this annotation

GitHub Actions / SQLFluff Lint

SQLFluff

LT01: Unnecessary trailing whitespace.
WITH base AS (
{%- if dataset_list | length == 0 -%}
Expand All @@ -52,7 +49,7 @@ storage_tier
{% if not loop.last %}UNION ALL{% endif %}
{% endfor %}
{%- endif -%}



)
Expand Down

0 comments on commit d293ac1

Please sign in to comment.