-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ele 3634 add snapshot to the report (#1703)
* add snapshot to the report - models, lineage, and groups * extend entity fields * filters help text * fix lineage * cli create temp table macro * fix groups and owners * remove empty line * update help text Co-authored-by: Mika Kerman <[email protected]> * add table name to snapshot * fix table name --------- Co-authored-by: Mika Kerman <[email protected]>
- Loading branch information
1 parent
69393bd
commit e8dbdbb
Showing
12 changed files
with
163 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
elementary/monitor/dbt_project/macros/create_temp_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% macro create_temp_table(database_name, schema_name, table_name, sql_query) %} | ||
{% do return(adapter.dispatch('create_temp_table','elementary_cli')(database_name, schema_name, table_name, sql_query)) %} | ||
{%- endmacro %} | ||
|
||
{% macro default__create_temp_table(database_name, schema_name, table_name, sql_query) %} | ||
{% do return(elementary.create_temp_table(database_name, schema_name, table_name, sql_query)) %} | ||
{% endmacro %} | ||
|
||
{% macro snowflake__create_temp_table(database_name, schema_name, table_name, sql_query) %} | ||
{% set temp_table_exists, temp_table_relation = dbt.get_or_create_relation(database=database_name, | ||
schema=schema_name, | ||
identifier=table_name, | ||
type='table') -%} | ||
{% set temp_table_relation = elementary.edr_make_temp_relation(temp_table_relation) %} | ||
{% set create_query %} | ||
create or replace temporary table {{ temp_table_relation }} | ||
as ( | ||
{{ sql_query }} | ||
); | ||
|
||
{% endset %} | ||
|
||
{% do elementary.run_query(create_query) %} | ||
|
||
{{ return(temp_table_relation) }} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% macro get_snapshots() %} | ||
{% set dbt_snapshots_relation = ref('elementary', 'dbt_snapshots') %} | ||
{%- if elementary.relation_exists(dbt_snapshots_relation) -%} | ||
{% set get_snapshots_query %} | ||
with dbt_artifacts_snapshots as ( | ||
select | ||
name, | ||
case when alias is not null then alias | ||
else name end as table_name, | ||
unique_id, | ||
owner as owners, | ||
tags, | ||
package_name, | ||
description, | ||
meta, | ||
materialization, | ||
database_name, | ||
schema_name, | ||
depends_on_macros, | ||
depends_on_nodes, | ||
original_path as full_path, | ||
path, | ||
patch_path, | ||
generated_at, | ||
unique_key, | ||
incremental_strategy | ||
from {{ dbt_snapshots_relation }} | ||
) | ||
select * from dbt_artifacts_snapshots | ||
{% endset %} | ||
|
||
{% set snapshots_agate = run_query(get_snapshots_query) %} | ||
{% do return(elementary.agate_to_dicts(snapshots_agate)) %} | ||
{%- endif -%} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters