-
Notifications
You must be signed in to change notification settings - Fork 209
Ele 3634 add snapshot to the report #1703
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eb817ba
add snapshot to the report - models, lineage, and groups
NoyaArie 5285293
extend entity fields
NoyaArie abd5926
filters help text
NoyaArie 6056ce8
fix lineage
NoyaArie 18ceb5b
cli create temp table macro
NoyaArie bf9dd26
fix groups and owners
NoyaArie d4a14b4
remove empty line
NoyaArie 407c974
update help text
NoyaArie a57ec54
add table name to snapshot
NoyaArie 36d6fb1
fix table name
NoyaArie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,33 @@ | ||
| {% 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, | ||
| 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.