Skip to content

Commit

Permalink
Merge branch 'master' into update-report-version
Browse files Browse the repository at this point in the history
  • Loading branch information
ellakz authored Oct 26, 2023
2 parents 4d05404 + 5358b96 commit 55e1179
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
15 changes: 9 additions & 6 deletions elementary/monitor/dbt_project/macros/base_queries/resources.sql
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,22 @@


{% macro get_resources_columns() %}
{% set resources_columns_query %}
with information_schema_columns as (
select * from {{ ref('elementary', 'information_schema_columns') }}
)
{% set columns_relation = ref('elementary', 'enriched_columns') %}
{% set column_name_field = 'name' %}
{% if not elementary.relation_exists(columns_relation) %}
{% set columns_relation = ref('elementary', 'dbt_columns') %}
{% set column_name_field = 'column_name' %}
{% endif %}

{% set resources_columns_query %}
select
full_table_name,
database_name,
schema_name,
table_name,
column_name,
{{ column_name_field }} as column_name,
data_type
from information_schema_columns
from {{ columns_relation }}
{% endset %}
{% set columns_agate = run_query(resources_columns_query) %}
{% set columns = elementary.agate_to_dicts(columns_agate) %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ config(
)
}}

with dbt_exposures as (
select * from {{ ref('dbt_exposures') }}
),

elementary_exposures as (
select * from {{ ref('elementary_cli', 'elementary_exposures') }}
)

{# Union without duplicates where elementary_exposures has prio #}
select * from dbt_exposures where dbt_exposures.unique_id not in (select elementary_exposures.unique_id from elementary_exposures)
{{ elementary.sql_union_distinct() }} select * from elementary_exposures
select
COALESCE(ee.unique_id, de.unique_id) as unique_id,
COALESCE(ee.name, de.name) as name,
COALESCE(ee.maturity, de.maturity) as maturity,
COALESCE(ee.type, de.type) as type,
COALESCE(ee.owner_email, de.owner_email) as owner_email,
COALESCE(ee.owner_name, de.owner_name) as owner_name,
COALESCE(ee.url, de.url) as url,
COALESCE(ee.depends_on_macros, de.depends_on_macros) as depends_on_macros,
COALESCE(ee.depends_on_nodes, de.depends_on_nodes) as depends_on_nodes,
COALESCE(ee.description, de.description) as description,
COALESCE(ee.tags, de.tags) as tags,
COALESCE(ee.meta, de.meta) as meta,
COALESCE(ee.package_name, de.package_name) as package_name,
COALESCE(ee.original_path, de.original_path) as original_path,
COALESCE(ee.path, de.path) as path,
COALESCE(ee.generated_at, de.generated_at) as generated_at,
COALESCE(ee.metadata_hash, de.metadata_hash) as metadata_hash,
COALESCE(ee.label, de.label) as label,
ee.raw_queries as raw_queries
from
{{ ref('dbt_exposures') }} de full join {{ ref('elementary_cli', 'elementary_exposures') }} ee on ee.unique_id = de.unique_id

0 comments on commit 55e1179

Please sign in to comment.