-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add dbt_queries model * Update docs * Add changelog entry * Fix tests * Remove dbt_metadata column
- Loading branch information
Showing
6 changed files
with
86 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Features | ||
body: Add dbt_queries model to easily understand dbt model costs with links to dbt | ||
Cloud | ||
time: 2022-12-21T13:28:10.065082Z | ||
custom: | ||
Author: NiallRees | ||
PR: "47" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
select | ||
dbt_metadata['dbt_version']::string as dbt_version, | ||
dbt_metadata['target_name']::string as dbt_target_name, | ||
dbt_metadata['target_database']::string as dbt_target_database, | ||
dbt_metadata['target_schema']::string as dbt_target_schema, | ||
dbt_metadata['invocation_id']::string as dbt_invocation_id, | ||
dbt_metadata['node_id']::string as dbt_node_id, | ||
dbt_metadata['node_resource_type']::string as dbt_node_resource_type, | ||
dbt_metadata['materialized']::string as dbt_node_materialized, | ||
dbt_metadata['is_incremental']::string as dbt_node_is_incremental, | ||
dbt_metadata['dbt_cloud_project_id']::string as dbt_cloud_project_id, | ||
dbt_metadata['dbt_cloud_job_id']::string as dbt_cloud_job_id, | ||
dbt_metadata['dbt_cloud_run_id']::string as dbt_cloud_run_id, | ||
dbt_metadata['dbt_cloud_run_reason_category']::string as dbt_cloud_run_reason_category, | ||
dbt_metadata['dbt_cloud_run_reason']::string as dbt_cloud_run_reason, | ||
{% if var('dbt_cloud_account_id', none) -%} | ||
'https://cloud.getdbt.com/next/deploy/' || '{{ var('dbt_cloud_account_id') }}' || '/projects/' || dbt_cloud_project_id || '/jobs/' || dbt_cloud_job_id as dbt_cloud_job_url, | ||
'https://cloud.getdbt.com/next/deploy/' || '{{ var('dbt_cloud_account_id') }}' || '/projects/' || dbt_cloud_project_id || '/runs/' || dbt_cloud_run_id as dbt_cloud_run_url, | ||
{%- else -%} | ||
'Required dbt_cloud_account_id variable not set' as dbt_cloud_job_url, | ||
'Required dbt_cloud_account_id variable not set' as dbt_cloud_run_url, | ||
{%- endif %} | ||
* exclude dbt_metadata | ||
from {{ ref('query_history_enriched') }} | ||
where dbt_metadata is not null |
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,38 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: dbt_queries | ||
description: Filtered version of query_history_enriched just for queries issued by dbt. Adds additional dbt-specific columns. | ||
columns: | ||
- name: dbt_version | ||
description: Version of dbt in use. | ||
- name: dbt_target_name | ||
description: The target name for the dbt invocation. | ||
- name: dbt_target_database | ||
description: The target database for the dbt invocation. | ||
- name: dbt_target_schema | ||
description: The target schema for the dbt invocation. | ||
- name: dbt_invocation_id | ||
description: The id of the dbt invocation. | ||
- name: dbt_node_id | ||
description: The identifier for the node that the query relates to. | ||
- name: dbt_node_resource_type | ||
description: The resource type of the node that the query relates to. | ||
- name: dbt_node_materialized | ||
description: The materialization of the node that the query relates to. | ||
- name: dbt_node_is_incremental | ||
description: The materialization of the node that the query relates to. | ||
- name: dbt_cloud_project_id | ||
description: If using dbt Cloud, the ID of the project. | ||
- name: dbt_cloud_job_id | ||
description: If using dbt Cloud, the ID of the issuing job. | ||
- name: dbt_cloud_run_id | ||
description: If using dbt Cloud, the ID of the issuing run. | ||
- name: dbt_cloud_run_reason_category | ||
description: If using dbt Cloud, the run reason category for the issuing run. | ||
- name: dbt_cloud_run_reason | ||
description: If using dbt Cloud, the run reason for the issuing run. | ||
- name: dbt_cloud_job_url | ||
description: If using dbt Cloud, the URL of the issuing job. The dbt_cloud_account_id dbt variable must be set for this field to populate. | ||
- name: dbt_cloud_run_url | ||
description: If using dbt Cloud, the URL of the issuing run. The dbt_cloud_account_id dbt variable must be set for this field to populate. |
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