Skip to content

Commit

Permalink
Merge pull request #44 from flexanalytics/columns-model-check
Browse files Browse the repository at this point in the history
check if table exists before uploading columns
  • Loading branch information
MiConnell authored Oct 1, 2024
2 parents 4c2dd31 + 58e48ad commit 8a5ad7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions macros/upload_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@
{% do lowerCols.update({k.lower(): v}) %}
{% endfor %}

{% set relation = dbt_observability.get_relation( model.name ) %}
{%- set columns = adapter.get_columns_in_relation(relation) -%}
{%- set relation = adapter.get_relation(database=model.database, schema=model.schema, identifier=model.name) -%}
{% set table_exists=relation is not none %}

{% if table_exists %}
{%- set columns = adapter.get_columns_in_relation(relation) -%}
{% endif %}

{% set statsType = dbt_observability.get_observability_value('column_stats_type', model) %}

Expand Down

0 comments on commit 8a5ad7d

Please sign in to comment.