From 107d3fd822614eac0bafdfc4186239efee4529ff Mon Sep 17 00:00:00 2001 From: Niall Woodward Date: Fri, 12 May 2023 00:11:38 +0100 Subject: [PATCH] Support dbt 1.5.0 --- .changes/2.0.2.md | 7 +++++++ CHANGELOG.md | 8 ++++++++ README.md | 2 +- dbt_project.yml | 2 +- macros/query_comment.sql | 6 +++++- tox.ini | 2 +- 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .changes/2.0.2.md diff --git a/.changes/2.0.2.md b/.changes/2.0.2.md new file mode 100644 index 0000000..da61165 --- /dev/null +++ b/.changes/2.0.2.md @@ -0,0 +1,7 @@ +## dbt-snowflake-query-tags 2.0.2 - May 12, 2023 + +### Features + +- Support dbt 1.5.0 ([#11](https://github.com/get-select/dbt-snowflake-query-tags/pull/11)) + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 68cded0..afaaaf5 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-query-tags 2.0.2 - May 12, 2023 + +### Features + +- Support dbt 1.5.0 ([#11](https://github.com/get-select/dbt-snowflake-query-tags/pull/11)) + + + ## dbt-snowflake-query-tags 2.0.1 - February 24, 2023 ### Features diff --git a/README.md b/README.md index 9260600..99c3c06 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ An example query comment contains: ```json { - "dbt_snowflake_query_tags_version": "2.0.1", + "dbt_snowflake_query_tags_version": "2.0.2", "app": "dbt", "dbt_version": "1.4.0", "project_name": "my_project", diff --git a/dbt_project.yml b/dbt_project.yml index f9fcfe3..8f4e2b5 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,3 +1,3 @@ name: 'dbt_snowflake_query_tags' -version: '2.0.1' +version: '2.0.2' config-version: 2 diff --git a/macros/query_comment.sql b/macros/query_comment.sql index 8ae118b..49d28a5 100644 --- a/macros/query_comment.sql +++ b/macros/query_comment.sql @@ -28,7 +28,11 @@ {%- if node.refs is defined -%} {% set refs = [] %} {% for ref in node.refs %} - {%- do refs.append(ref[0]) -%} + {%- if dbt_version >= '1.5.0' -%} + {%- do refs.append(ref.name) -%} + {%- else -%} + {%- do refs.append(ref[0]) -%} + {%- endif -%} {% endfor %} {%- do comment_dict.update( node_refs=refs | unique | list diff --git a/tox.ini b/tox.ini index 756db88..e42f833 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ passenv = [testenv:snowflake] changedir = integration_test_project -deps = dbt-snowflake~=1.4.0 +deps = dbt-snowflake~=1.5.0 commands = dbt deps dbt build --full-refresh