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

Ensure that enriched exposures still works if cli views have not been synced #1406

Merged
merged 1 commit into from
Feb 11, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ config(
}}

{% set dbt_exposures_relation = ref('dbt_exposures') %}
{% set depends_on_columns_column_exists = elementary.column_exists_in_relation(dbt_exposures_relation, 'depends_on_columns') %}
{% set elementary_exposures_relation = ref('elementary_cli', 'elementary_exposures') %}
{% set depends_on_columns_column_exists_on_dbt_exposures = elementary.column_exists_in_relation(dbt_exposures_relation, 'depends_on_columns') %}
{% set depends_on_columns_column_exists_on_elementary_exposures = elementary.column_exists_in_relation(elementary_exposures_relation, 'depends_on_columns') %}

select
COALESCE(ee.unique_id, de.unique_id) as unique_id,
Expand All @@ -29,10 +31,14 @@ select
COALESCE(ee.metadata_hash, de.metadata_hash) as metadata_hash,
COALESCE(ee.label, de.label) as label,
COALESCE(ee.raw_queries, de.raw_queries) as raw_queries,
{% if depends_on_columns_column_exists %}
{% if depends_on_columns_column_exists_on_dbt_exposures and depends_on_columns_column_exists_on_elementary_exposures %}
COALESCE(ee.depends_on_columns, de.depends_on_columns) as depends_on_columns
{% else %}
{% elif depends_on_columns_column_exists_on_elementary_exposures %}
ee.depends_on_columns as depends_on_columns
{% elif depends_on_columns_column_exists_on_dbt_exposures %}
de.depends_on_columns as depends_on_columns
{% else %}
null as depends_on_columns
{% endif %}
from
{{ dbt_exposures_relation }} de full join {{ ref('elementary_cli', 'elementary_exposures') }} ee on ee.name = de.name
{{ dbt_exposures_relation }} de full join {{ elementary_exposures_relation }} ee on ee.name = de.name
Loading