Skip to content

Commit

Permalink
approach 3 tweak: prefilter relation schemas in bigquery__get_relatio…
Browse files Browse the repository at this point in the history
…n_last_modified
  • Loading branch information
MichelleArk committed May 13, 2024
1 parent d5eeb4e commit 51243e5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dbt/include/bigquery/macros/metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
{{ current_timestamp() }} as snapshotted_at
-- TODO: stop hardcoding this
from `region-us`.INFORMATION_SCHEMA.TABLE_STORAGE
where (
-- TODO: preprocessing unique schemas would make the query size smaller
where (upper(table_schema) IN (
{%- for relation in relations -%}
upper('{{ relation.schema }}'){%- if not loop.last %},{% endif -%}
{%- endfor -%}
)
)
and (
{%- for relation in relations -%}
(upper(table_schema) = upper('{{ relation.schema }}') and
upper(table_name) = upper('{{ relation.identifier }}')){%- if not loop.last %} or {% endif -%}
Expand Down

0 comments on commit 51243e5

Please sign in to comment.