From 6458455d8fdaf7d21374442f1140a2269b920e27 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Thu, 23 Feb 2023 23:53:43 +0000 Subject: [PATCH 01/12] WIP --- macros/create_merge_objects_udf.sql | 12 ++++++++++++ ...e_regex_udf.sql => create_regexp_replace_udf.sql} | 0 macros/query_comment.sql | 3 +++ models/query_history_enriched.sql | 8 ++++---- packages.yml | 4 ++-- 5 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 macros/create_merge_objects_udf.sql rename macros/{create_regex_udf.sql => create_regexp_replace_udf.sql} (100%) create mode 100644 macros/query_comment.sql diff --git a/macros/create_merge_objects_udf.sql b/macros/create_merge_objects_udf.sql new file mode 100644 index 0000000..2a92553 --- /dev/null +++ b/macros/create_merge_objects_udf.sql @@ -0,0 +1,12 @@ +{% macro create_merge_objects_udf(relation) %} + +create or replace function {{ relation.database }}.{{ relation.schema }}.merge_objects(obj1 variant, obj2 variant) +returns variant +language javascript +comment = 'Created by dbt-snowflake-monitoring dbt package.' +as +$$ + return x = Object.assign(obj1, obj2) +$$ + +{% endmacro %} diff --git a/macros/create_regex_udf.sql b/macros/create_regexp_replace_udf.sql similarity index 100% rename from macros/create_regex_udf.sql rename to macros/create_regexp_replace_udf.sql diff --git a/macros/query_comment.sql b/macros/query_comment.sql new file mode 100644 index 0000000..d376d08 --- /dev/null +++ b/macros/query_comment.sql @@ -0,0 +1,3 @@ +{% macro get_query_comment(node) %} + {{ return(dbt_snowflake_query_tags.get_query_comment(node)) }} +{% endmacro %} diff --git a/models/query_history_enriched.sql b/models/query_history_enriched.sql index 97daccf..18082cf 100644 --- a/models/query_history_enriched.sql +++ b/models/query_history_enriched.sql @@ -1,7 +1,7 @@ {{ config( materialized='incremental', unique_key=['query_id', 'start_time'], - pre_hook="{{ create_regexp_replace_udf(this) }}" + pre_hook=["{{ create_regexp_replace_udf(this) }}", "{{ create_object_merge_udf(this) }}"] ) }} with @@ -12,11 +12,11 @@ query_history as ( -- this removes comments enclosed by /* */ and single line comments starting with -- and either ending with a new line or end of string {{ this.database }}.{{ this.schema }}.dbt_snowflake_monitoring_regexp_replace(query_text, $$(/\*(.|\n|\r)*?\*/)|(--.*$)|(--.*(\n|\r))$$, '') as query_text_no_comments, - regexp_substr(query_text, '/\\*\\s({"app":\\s"dbt".*})\\s\\*/', 1, 1, 'ie') as _dbt_json_meta, + try_parse_json(regexp_substr(query_text, '/\\*\\s({"app":\\s"dbt".*})\\s\\*/', 1, 1, 'ie')) as _dbt_json_comment_meta, case when try_parse_json(query_tag)['dbt_snowflake_query_tags_version'] is not null then try_parse_json(query_tag) - else try_parse_json(_dbt_json_meta) - end as dbt_metadata + end as _dbt_json_query_tag_meta, + {{ this.database }}.{{ this.schema }}.merge_objects(_dbt_json_comment_meta, _dbt_json_query_tag_meta) as dbt_metadata from {{ ref('stg_query_history') }} diff --git a/packages.yml b/packages.yml index daf31e7..43d667e 100644 --- a/packages.yml +++ b/packages.yml @@ -1,5 +1,5 @@ packages: - package: dbt-labs/dbt_utils version: [">=0.8.0", "<2.0.0"] - - package: get-select/dbt_snowflake_query_tags - version: 1.1.3 + - git: https://github.com/get-select/dbt-snowflake-query-tags.git + revision: use_comments_and_query_tags From 769423437d1818835d052f1a6df0acb2161ba721 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Thu, 23 Feb 2023 23:59:28 +0000 Subject: [PATCH 02/12] Use comments and query tags --- README.md | 20 +++++++++++++++----- dbt_project.yml | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6ddc529..b34a06f 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,23 @@ From the [SELECT](https://select.dev) team, a dbt package to help you monitor Sn ## Quickstart -Grant dbt's role access to the `snowflake` database: +1. Grant dbt's role access to the `snowflake` database: ```sql grant imported privileges on database snowflake to role your_dbt_role_name; ``` -Add the following to your `packages.yml` file: +2. Add the package to your `packages.yml` file: ```yaml packages: - package: get-select/dbt_snowflake_monitoring - version: 2.0.2 + version: 3.0.0 ``` -To attribute costs to individual models via the `dbt_metadata` column in the `query_history_enriched` model, query tags are added to all dbt-issued queries. To configure the tags, follow one of the two options below. +3. To attribute costs to individual models via the `dbt_metadata` column in the `query_history_enriched` model, query comments and tags are added to all dbt-issued queries. Both query comments and tags are needed to collect the required metadata for the `dbt_queries` model. + +To add the query tags follow one of these two options: Option 1: If running dbt < 1.2, create a folder named `macros` in your dbt project's top level directory (if it doesn't exist). Inside, make a new file called `query_tags.sql` with the following content: @@ -32,7 +34,7 @@ Option 1: If running dbt < 1.2, create a folder named `macros` in your dbt proje {% endmacro %} ``` -Option 2: If running dbt >= 1.2, you can simply configure the dispatch search order in your `dbt_project.yml`. +Option 2: If running dbt >= 1.2, simply configure the dispatch search order in `dbt_project.yml`. ```yaml dispatch: @@ -43,6 +45,14 @@ dispatch: - dbt ``` +4. To configure the query comments, add the following config to `dbt_project.yml`. + +```yaml +query-comment: + comment: '{{ dbt_snowflake_query_tags.get_query_comment(node) }}' + append: true # Snowflake removes prefixed comments. +``` + That's it! All dbt-issued queries will now be tagged and start appearing in the `dbt_queries.sql` model. ## Package Alternatives & Maintenance diff --git a/dbt_project.yml b/dbt_project.yml index a2abbb4..d52e6e6 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'dbt_snowflake_monitoring' -version: '2.0.2' +version: '3.0.0' config-version: 2 profile: dbt_snowflake_monitoring From 7b1cc9c5ca41d867ab11c0b673acfcefcc583549 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 00:02:31 +0000 Subject: [PATCH 03/12] Add query comment to integration tests --- README.md | 2 +- integration_test_project/dbt_project.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b34a06f..3f92908 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ dispatch: ```yaml query-comment: - comment: '{{ dbt_snowflake_query_tags.get_query_comment(node) }}' + comment: '{{ dbt_snowflake_monitoring.get_query_comment(node) }}' append: true # Snowflake removes prefixed comments. ``` diff --git a/integration_test_project/dbt_project.yml b/integration_test_project/dbt_project.yml index 776dfba..4dc10e4 100644 --- a/integration_test_project/dbt_project.yml +++ b/integration_test_project/dbt_project.yml @@ -21,3 +21,7 @@ dispatch: vars: account_locator: a09e1 + +query-comment: + comment: '{{ dbt_snowflake_monitoring.get_query_comment(node) }}' + append: true # Snowflake removes prefixed comments. From 3e62567ea9e8944753c175518c3899cb0098e3a6 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 00:09:14 +0000 Subject: [PATCH 04/12] Fix macro --- models/query_history_enriched.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/query_history_enriched.sql b/models/query_history_enriched.sql index 18082cf..fab0c35 100644 --- a/models/query_history_enriched.sql +++ b/models/query_history_enriched.sql @@ -1,7 +1,7 @@ {{ config( materialized='incremental', unique_key=['query_id', 'start_time'], - pre_hook=["{{ create_regexp_replace_udf(this) }}", "{{ create_object_merge_udf(this) }}"] + pre_hook=["{{ create_regexp_replace_udf(this) }}", "{{ create_merge_objects_udf(this) }}"] ) }} with From b8c7991aabad7795c7b1191da8560c16762d419d Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 00:35:46 +0000 Subject: [PATCH 05/12] Add merge objects UDF --- macros/create_merge_objects_udf.sql | 2 +- models/query_history_enriched.sql | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/macros/create_merge_objects_udf.sql b/macros/create_merge_objects_udf.sql index 2a92553..f0461dd 100644 --- a/macros/create_merge_objects_udf.sql +++ b/macros/create_merge_objects_udf.sql @@ -6,7 +6,7 @@ language javascript comment = 'Created by dbt-snowflake-monitoring dbt package.' as $$ - return x = Object.assign(obj1, obj2) + return x = Object.assign(OBJ1, OBJ2) $$ {% endmacro %} diff --git a/models/query_history_enriched.sql b/models/query_history_enriched.sql index fab0c35..1a61512 100644 --- a/models/query_history_enriched.sql +++ b/models/query_history_enriched.sql @@ -16,7 +16,10 @@ query_history as ( case when try_parse_json(query_tag)['dbt_snowflake_query_tags_version'] is not null then try_parse_json(query_tag) end as _dbt_json_query_tag_meta, - {{ this.database }}.{{ this.schema }}.merge_objects(_dbt_json_comment_meta, _dbt_json_query_tag_meta) as dbt_metadata + case + when _dbt_json_comment_meta is not null or _dbt_json_query_tag_meta is not null then + {{ this.database }}.{{ this.schema }}.merge_objects(coalesce(_dbt_json_comment_meta, {}), coalesce(_dbt_json_query_tag_meta, {})) + end as dbt_metadata from {{ ref('stg_query_history') }} From d87b8f0d36f3d81b12153d138e10c93f9631431e Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 01:03:42 +0000 Subject: [PATCH 06/12] Add note on dbt Cloud URLs --- README.md | 6 ++++++ models/dbt_queries.sql | 25 ++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3f92908..0b17921 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,12 @@ query-comment: That's it! All dbt-issued queries will now be tagged and start appearing in the `dbt_queries.sql` model. +### dbt Cloud URLs + +If you're using dbt Cloud, columns `dbt_cloud_job_url` and `dbt_cloud_run_url` can be configured in the `dbt_queries` model. To do so, set the variable `dbt_cloud_account_id`. This id can be retrieved from in between `/deploy/` and `/projects/` in any dbt Cloud URL. + +By default, the URL prefix of `https://cloud.getdbt.com/deploy/` is used. If you're using a different region of dbt Cloud, this prefix can be overridden by specifying the `dbt_cloud_url` variable. + ## Package Alternatives & Maintenance Prior to releasing this package, [snowflake-spend](https://gitlab.com/gitlab-data/snowflake_spend) by the Gitlab data team was the only package available for monitoring Snowflake spend. According to their README, the package is currently maintained by the Gitlab data team, but there does not appear to be any active development in it (as of January 2023). diff --git a/models/dbt_queries.sql b/models/dbt_queries.sql index 4a25548..b8fe65a 100644 --- a/models/dbt_queries.sql +++ b/models/dbt_queries.sql @@ -27,14 +27,25 @@ select 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, + case + when dbt_cloud_project_id is not null + then + {% if var('dbt_cloud_account_id', none) -%} + var('dbt_cloud_url', 'https://cloud.getdbt.com/deploy/') || '{{ var('dbt_cloud_account_id') }}' || '/projects/' || dbt_cloud_project_id || '/jobs/' || dbt_cloud_job_id + {%- else -%} + 'Required dbt_cloud_account_id variable not set' -- noqa + {%- endif %} + end as dbt_cloud_job_url, + case + when dbt_cloud_project_id is not null + then + {% if var('dbt_cloud_account_id', none) -%} + var('dbt_cloud_url', 'https://cloud.getdbt.com/deploy/') || '{{ var('dbt_cloud_account_id') }}' || '/projects/' || dbt_cloud_project_id || '/runs/' || dbt_cloud_run_id + {%- else -%} + 'Required dbt_cloud_account_id variable not set' -- noqa + {%- endif %} + end as dbt_cloud_run_url, min(start_time) over (partition by dbt_invocation_id, dbt_node_id order by start_time asc) as node_start_time, - {% 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, -- noqa - '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 From 48426c3a9c8acea89d518a5601a841dc1a352d1f Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 01:07:17 +0000 Subject: [PATCH 07/12] Release 3.0.0 --- .changes/unreleased/Fixes-20230224-010714.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20230224-010714.yaml diff --git a/.changes/unreleased/Fixes-20230224-010714.yaml b/.changes/unreleased/Fixes-20230224-010714.yaml new file mode 100644 index 0000000..9e3bab1 --- /dev/null +++ b/.changes/unreleased/Fixes-20230224-010714.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Use query comments and query tags to avoid query tag character limit +time: 2023-02-24T01:07:14.588293Z +custom: + Author: NiallRees + PR: "87" From ac38f463c3ebe0f4ec8359e62a1037f6ec27458e Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 10:03:12 +0000 Subject: [PATCH 08/12] Use query tags 2.0.0 --- packages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages.yml b/packages.yml index 43d667e..5d650fc 100644 --- a/packages.yml +++ b/packages.yml @@ -1,5 +1,5 @@ packages: - package: dbt-labs/dbt_utils version: [">=0.8.0", "<2.0.0"] - - git: https://github.com/get-select/dbt-snowflake-query-tags.git - revision: use_comments_and_query_tags + - package: get-select/dbt_snowflake_query_tags + version: 2.0.0 From defdc38ffe3b87e06903b60e5ae1689793a0f836 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 14:01:54 +0000 Subject: [PATCH 09/12] Use 2.0.1 --- packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.yml b/packages.yml index 5d650fc..d7e67f4 100644 --- a/packages.yml +++ b/packages.yml @@ -2,4 +2,4 @@ packages: - package: dbt-labs/dbt_utils version: [">=0.8.0", "<2.0.0"] - package: get-select/dbt_snowflake_query_tags - version: 2.0.0 + version: 2.0.1 From 7a33299b82cb730d116dae091555d9f9ed9c2442 Mon Sep 17 00:00:00 2001 From: NiallRees Date: Fri, 24 Feb 2023 15:15:06 +0000 Subject: [PATCH 10/12] Get dbt model tags --- models/dbt_queries.sql | 2 +- models/dbt_queries.yml | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/models/dbt_queries.sql b/models/dbt_queries.sql index b8fe65a..2a35243 100644 --- a/models/dbt_queries.sql +++ b/models/dbt_queries.sql @@ -12,6 +12,7 @@ select dbt_metadata['materialized']::string as dbt_node_materialized, dbt_metadata['is_incremental']::boolean as dbt_node_is_incremental, dbt_metadata['node_alias']::string as dbt_node_alias, + dbt_metadata['node_tags']::array as node_tags, iff(dbt_snowflake_query_tags_version >= '1.1.3', dbt_metadata['node_refs']::array, []) as dbt_node_refs, -- correct refs available from 1.1.3 onwards dbt_metadata['node_database']::string as dbt_node_database, dbt_metadata['node_schema']::string as dbt_node_schema, @@ -45,7 +46,6 @@ select 'Required dbt_cloud_account_id variable not set' -- noqa {%- endif %} end as dbt_cloud_run_url, - min(start_time) over (partition by dbt_invocation_id, dbt_node_id order by start_time asc) as node_start_time, * exclude dbt_metadata from {{ ref('query_history_enriched') }} where dbt_metadata is not null diff --git a/models/dbt_queries.yml b/models/dbt_queries.yml index 87a84ad..feec823 100644 --- a/models/dbt_queries.yml +++ b/models/dbt_queries.yml @@ -4,24 +4,44 @@ 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_snowflake_query_tags_version + description: Version of the dbt-snowflake-query-tags package that generated the metadata - 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_name + description: The name 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. + description: Boolean describing if the node run was incremental. + - name: dbt_node_alias + description: Alias set for the node. + - name: dbt_node_tags + description: Array of all tags set for the node. + - name: dbt_node_refs + description: Array of all refs used by the node. + - name: dbt_node_database + description: The database configured for the node. + - name: dbt_node_schema + description: The schema configured for the node. + - name: dbt_version + description: Version of dbt in use. + - name: dbt_project_name + description: Name of the dbt project. + - 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_node_package_name + description: The package name of the dbt node. + - name: dbt_node_original_file_path + description: The file path of the dbt node. - name: dbt_cloud_project_id description: If using dbt Cloud, the ID of the project. - name: dbt_cloud_job_id From 2bc01c69c39c4c7e87ccbe9179ab3137a2736e50 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Sun, 26 Feb 2023 17:59:00 +0000 Subject: [PATCH 11/12] Changelog --- .changes/3.0.0.md | 7 +++++++ .changes/unreleased/Fixes-20230224-010714.yaml | 6 ------ CHANGELOG.md | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .changes/3.0.0.md delete mode 100644 .changes/unreleased/Fixes-20230224-010714.yaml diff --git a/.changes/3.0.0.md b/.changes/3.0.0.md new file mode 100644 index 0000000..2c79ac9 --- /dev/null +++ b/.changes/3.0.0.md @@ -0,0 +1,7 @@ +## dbt-snowflake-monitoring 3.0.0 - February 26, 2023 + +### Fixes + +- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) + + diff --git a/.changes/unreleased/Fixes-20230224-010714.yaml b/.changes/unreleased/Fixes-20230224-010714.yaml deleted file mode 100644 index 9e3bab1..0000000 --- a/.changes/unreleased/Fixes-20230224-010714.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Use query comments and query tags to avoid query tag character limit -time: 2023-02-24T01:07:14.588293Z -custom: - Author: NiallRees - PR: "87" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7de59d6..e9420f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## dbt-snowflake-monitoring 3.0.0 - February 26, 2023 + +### Fixes + +- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) + + + ## dbt-snowflake-monitoring 2.0.2 - February 21, 2023 ### Fixes From b452418b9f610af04c508fe0869ac62131af7404 Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Sun, 26 Feb 2023 18:05:59 +0000 Subject: [PATCH 12/12] Release 3.0.0 --- .changes/3.0.0.md | 9 ++++++--- CHANGELOG.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.changes/3.0.0.md b/.changes/3.0.0.md index 2c79ac9..ccab7c0 100644 --- a/.changes/3.0.0.md +++ b/.changes/3.0.0.md @@ -1,7 +1,10 @@ ## dbt-snowflake-monitoring 3.0.0 - February 26, 2023 +After attempting to use only query comments or query tags in versions 1 and 2, we've learned we actually need both. The reasons for that are: +* The `is_incremental` macro is only available from within the query tag dbt context, and is needed to determine whether a model run is incremental or not. +* Query tags have a maximum character limit of 2000, which is easily exceeded by a list of refs containing more than a few models. -### Fixes - -- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) +To upgrade from 2.x.x, follow the latest instructions in the [Quickstart](https://github.com/get-select/dbt-snowflake-monitoring#quickstart). The package is still able to process query metadata generated by previous versions of the package, so no data will be lost on upgrade. +### Breaking Changes +- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9420f0..681d0a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,15 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). ## dbt-snowflake-monitoring 3.0.0 - February 26, 2023 +After attempting to use only query comments or query tags in versions 1 and 2, we've learned we actually need both. The reasons for that are: +* The `is_incremental` macro is only available from within the query tag dbt context, and is needed to determine whether a model run is incremental or not. +* Query tags have a maximum character limit of 2000, which is easily exceeded by a list of refs containing more than a few models. -### Fixes - -- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) +To upgrade from 2.x.x, follow the latest instructions in the [Quickstart](https://github.com/get-select/dbt-snowflake-monitoring#quickstart). The package is still able to process query metadata generated by previous versions of the package, so no data will be lost on upgrade. +### Breaking Changes +- Use query comments and query tags to avoid query tag character limit ([#87](https://github.com/get-select/dbt-snowflake-monitoring/pull/87)) ## dbt-snowflake-monitoring 2.0.2 - February 21, 2023