├── .changes ├── 1.0.0.md ├── 1.1.0.md ├── 1.1.1.md ├── 1.1.2.md ├── 1.1.3.md ├── 2.0.0.md ├── 2.0.1.md ├── 2.0.2.md ├── 2.1.0.md ├── 2.2.0.md ├── 2.3.0.md ├── 2.3.1.md ├── 2.3.2.md ├── 2.3.3.md ├── 2.4.0.md ├── 2.4.1.md ├── 2.5.0.md ├── header.tpl.md └── unreleased │ └── .gitkeep ├── .changie.yaml ├── .editorconfig ├── .github └── workflows │ ├── ci_dbt_test_package.yml │ ├── ci_test_package.yml │ └── main_test_package.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── dbt_project.yml ├── integration_tests ├── dbt_project.yml ├── models │ ├── materialized_ephemeral.sql │ ├── materialized_incremental.sql │ ├── materialized_table.sql │ └── materialized_view.sql ├── packages.yml ├── profiles.yml ├── seeds │ └── test_seed.csv ├── snapshots │ └── snapshot.sql └── tests │ ├── dbt_project_configured_meta │ └── test_2.sql │ └── test.sql ├── macros ├── query_comment.sql └── query_tags.sql ├── supported_adapters.env └── tox.ini /.changes/1.0.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 1.0.0 - February 08, 2023 2 | 3 | ### Features 4 | 5 | - Initial release 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/1.1.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 1.1.0 - February 11, 2023 2 | 3 | ### Features 4 | 5 | - Add node refs to tag ([#1](https://github.com/get-select/dbt-snowflake-query-tags/pull/1)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/1.1.1.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 1.1.1 - February 12, 2023 2 | 3 | ### Fixes 4 | 5 | - Fix refs list ([#4](https://github.com/get-select/dbt-snowflake-query-tags/pull/4)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/1.1.2.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 1.1.2 - February 13, 2023 2 | 3 | ### Features 4 | 5 | - Support dispatch order for macro configuration ([#2](https://github.com/get-select/dbt-snowflake-query-tags/pull/2)) 6 | 7 | ### Contributors 8 | - [@robscriva](https://github.com/robscriva) (Features) 9 | 10 | -------------------------------------------------------------------------------- /.changes/1.1.3.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 1.1.3 - February 13, 2023 2 | 3 | ### Fixes 4 | 5 | - Dedupe refs ([#6](https://github.com/get-select/dbt-snowflake-query-tags/pull/6)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.0.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.0.0 - February 24, 2023 2 | 3 | ### Fixes 4 | 5 | - Use query comments and query tags to avoid query tag character limit ([#8](https://github.com/get-select/dbt-snowflake-query-tags/pull/8)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.0.1.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.0.1 - February 24, 2023 2 | 3 | ### Features 4 | 5 | - Add dbt tags to comment metadata ([#9](https://github.com/get-select/dbt-snowflake-query-tags/pull/9)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.0.2.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.0.2 - May 12, 2023 2 | 3 | ### Features 4 | 5 | - Support dbt 1.5.0 ([#11](https://github.com/get-select/dbt-snowflake-query-tags/pull/11)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.1.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.1.0 - May 26, 2023 2 | 3 | ### Features 4 | 5 | - Add dbt meta to comment metadata ([#13](https://github.com/get-select/dbt-snowflake-query-tags/pull/13)) 6 | 7 | ### Contributors 8 | - [@pratik60](https://github.com/pratik60) (Features) 9 | 10 | -------------------------------------------------------------------------------- /.changes/2.2.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.2.0 - June 23, 2023 2 | 3 | ### Features 4 | 5 | - Add full_refresh, which and invocation_command to comment ([#15](https://github.com/get-select/dbt-snowflake-query-tags/pull/15)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.3.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.3.0 - June 29, 2023 2 | 3 | ### Features 4 | 5 | - Add thread_id to query tag ([#16](https://github.com/get-select/dbt-snowflake-query-tags/pull/16)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.3.1.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.3.1 - August 18, 2023 2 | 3 | ### Features 4 | 5 | - Handle non-mapping configs gracefully ([#17](https://github.com/get-select/dbt-snowflake-query-tags/pull/17)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.3.2.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.3.2 - January 18, 2024 2 | 3 | ### Features 4 | 5 | - Support for query tags from profiles.yml and environment variables ([#21](https://github.com/get-select/dbt-snowflake-query-tags/pull/21)) 6 | - Add support for custom query comment keys and values ([#22](https://github.com/get-select/dbt-snowflake-query-tags/pull/22)) 7 | 8 | ### Contributors 9 | - [@maddoc1](https://github.com/maddoc1) (Features) 10 | 11 | -------------------------------------------------------------------------------- /.changes/2.3.3.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.3.3 - January 29, 2024 2 | 3 | ### Features 4 | 5 | - Remove warning on session level query tag ([#22](https://github.com/get-select/dbt-snowflake-query-tags/pull/22)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.4.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.4.0 - May 14, 2024 2 | 3 | ### Features 4 | 5 | - Add raw_code_hash to query comment ([#26](https://github.com/get-select/dbt-snowflake-query-tags/pull/26)) 6 | - Add run_started_at to query comment ([#27](https://github.com/get-select/dbt-snowflake-query-tags/pull/27)) 7 | 8 | ### Contributors 9 | - [@bmoore813](https://github.com/bmoore813) (Features) 10 | - [@bisset-a](https://github.com/bisset-a) (Features) 11 | -------------------------------------------------------------------------------- /.changes/2.4.1.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.4.1 - May 14, 2024 2 | 3 | ### Fixes 4 | 5 | - Check for local_md5 as only added in dbt 1.4.0 ([#30](https://github.com/get-select/dbt-snowflake-query-tags/pull/30)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/2.5.0.md: -------------------------------------------------------------------------------- 1 | ## dbt-snowflake-query-tags 2.5.0 - May 15, 2024 2 | 3 | ### Features 4 | 5 | - Support custom extra kwarg for query tag meta ([#30](https://github.com/get-select/dbt-snowflake-query-tags/pull/30)) 6 | 7 | 8 | -------------------------------------------------------------------------------- /.changes/header.tpl.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), 6 | and is generated by [Changie](https://github.com/miniscruff/changie). 7 | -------------------------------------------------------------------------------- /.changes/unreleased/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/get-select/dbt-snowflake-query-tags/c9f42abb25d752b0c014fabf82077f094dcb41ba/.changes/unreleased/.gitkeep -------------------------------------------------------------------------------- /.changie.yaml: -------------------------------------------------------------------------------- 1 | # Mainly from https://github.com/dbt-labs/dbt-core/blob/main/.changie.yaml 2 | 3 | changesDir: .changes 4 | unreleasedDir: unreleased 5 | headerPath: header.tpl.md 6 | changelogPath: CHANGELOG.md 7 | versionExt: md 8 | versionFormat: '## dbt-snowflake-query-tags {{.Version}} - {{.Time.Format "January 02, 2006"}}' 9 | kindFormat: '### {{.Kind}}' 10 | changeFormat: '- {{.Body}} ([#{{.Custom.PR}}](https://github.com/get-select/dbt-snowflake-query-tags/pull/{{.Custom.PR}}))' 11 | kinds: 12 | - label: Breaking Changes 13 | - label: Features 14 | - label: Fixes 15 | - label: Docs 16 | newlines: 17 | afterChangelogHeader: 1 18 | afterKind: 1 19 | afterChangelogVersion: 1 20 | beforeKind: 1 21 | endOfVersion: 1 22 | custom: 23 | - key: Author 24 | label: GitHub Username(s) (separated by a single space if multiple) 25 | type: string 26 | minLength: 3 27 | - key: PR 28 | label: GitHub Pull Request Number 29 | type: int 30 | minInt: 1 31 | 32 | footerFormat: | 33 | {{- $contributorDict := dict }} 34 | {{- /* any names added to this list should be all lowercase for later matching purposes */}} 35 | {{- $core_team := list "niallrees" "ian-whitestone" }} 36 | {{- range $change := .Changes }} 37 | {{- $authorList := splitList " " $change.Custom.Author }} 38 | {{- /* loop through all authors for a PR */}} 39 | {{- range $author := $authorList }} 40 | {{- $authorLower := lower $author }} 41 | {{- /* we only want to include non-core team contributors */}} 42 | {{- if not (has $authorLower $core_team)}} 43 | {{- /* Docs kind link back to dbt-docs instead of dbt-core PRs */}} 44 | {{- $prLink := $change.Kind }} 45 | {{- /* check if this contributor has other PRs associated with them already */}} 46 | {{- if hasKey $contributorDict $author }} 47 | {{- $prList := get $contributorDict $author }} 48 | {{- $prList = append $prList $prLink }} 49 | {{- $contributorDict := set $contributorDict $author $prList }} 50 | {{- else }} 51 | {{- $prList := list $prLink }} 52 | {{- $contributorDict := set $contributorDict $author $prList }} 53 | {{- end }} 54 | {{- end}} 55 | {{- end}} 56 | {{- end }} 57 | {{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}} 58 | {{- if $contributorDict}} 59 | ### Contributors 60 | {{- range $k,$v := $contributorDict }} 61 | - [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}}) 62 | {{- end }} 63 | {{- end }} 64 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.yml] 12 | indent_size = 2 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.github/workflows/ci_dbt_test_package.yml: -------------------------------------------------------------------------------- 1 | # **what?** 2 | # Run tests for dbt-snowflake-query-tags against supported adapters 3 | 4 | # **why?** 5 | # To ensure that dbt-snowflake-query-tags works as expected with all supported adapters 6 | 7 | # **when?** 8 | # On every PR, and every push to main and when manually triggered 9 | 10 | name: Package Integration Tests 11 | 12 | on: 13 | push: 14 | branches: 15 | - main 16 | pull_request: 17 | workflow_dispatch: 18 | 19 | jobs: 20 | run-tests: 21 | uses: dbt-labs/dbt-package-testing/.github/workflows/run_tox.yml@v1 22 | with: 23 | SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_TEST_USER }} 24 | SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }} 25 | SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_TEST_DATABASE }} 26 | SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }} 27 | SNOWFLAKE_SCHEMA: "integration_tests_snowflake_${{ github.run_number }}" 28 | secrets: 29 | SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} 30 | DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }} -------------------------------------------------------------------------------- /.github/workflows/ci_test_package.yml: -------------------------------------------------------------------------------- 1 | name: CI test package 2 | 3 | on: 4 | workflow_dispatch: 5 | # all PRs, important to note that `pull_request_target` workflows 6 | # will run in the context of the target branch of a PR 7 | pull_request_target: 8 | 9 | env: 10 | # These are configured in GitHub secrets 11 | DBT_PROFILES_DIR: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/integration_tests 12 | GITHUB_SHA_OVERRIDE: ${{ github.event.pull_request.head.sha }} # We need the commit hash of the pull request branch's head, the GITHUB_SHA env var is always the base branch in a pull_request_target trigger 13 | SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} 14 | SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_TEST_USER }} 15 | DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }} 16 | SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }} 17 | SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_TEST_DATABASE }} 18 | SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }} 19 | SNOWFLAKE_SCHEMA: "integration_tests_snowflake_${{ github.run_number }}" 20 | 21 | 22 | jobs: 23 | integration-snowflake: 24 | runs-on: ubuntu-latest 25 | environment: 26 | name: Approve Integration Tests 27 | 28 | steps: 29 | - name: Checkout 30 | uses: actions/checkout@v2 31 | with: 32 | ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR 33 | 34 | - name: Install tox 35 | run: python3 -m pip install tox 36 | 37 | - name: Run Snowflake Tests 38 | run: tox -e snowflake 39 | -------------------------------------------------------------------------------- /.github/workflows/main_test_package.yml: -------------------------------------------------------------------------------- 1 | name: Main branch test package 2 | 3 | # triggers for the workflow 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - main 9 | 10 | env: 11 | # These are configured in GitHub secrets 12 | DBT_PROFILES_DIR: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/integration_tests 13 | GITHUB_SHA_OVERRIDE: ${{ github.event.pull_request.head.sha }} # We need the commit hash of the pull request branch's head, the GITHUB_SHA env var is always the base branch in a pull_request_target trigger 14 | DBT_ENV_SECRET_SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }} 15 | DBT_ENV_SECRET_SNOWFLAKE_TEST_USER: ${{ secrets.SNOWFLAKE_TEST_USER }} 16 | DBT_ENV_SECRET_SNOWFLAKE_TEST_PASSWORD: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }} 17 | DBT_ENV_SECRET_SNOWFLAKE_TEST_ROLE: ${{ secrets.SNOWFLAKE_TEST_ROLE }} 18 | DBT_ENV_SECRET_SNOWFLAKE_TEST_DATABASE: ${{ secrets.SNOWFLAKE_TEST_DATABASE }} 19 | DBT_ENV_SECRET_SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.SNOWFLAKE_TEST_WAREHOUSE }} 20 | 21 | jobs: 22 | integration-snowflake: 23 | runs-on: ubuntu-latest 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v2 28 | 29 | - name: Install tox 30 | run: python3 -m pip install tox 31 | 32 | - name: Run Snowflake Tests 33 | run: tox -e snowflake 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | dbt_packages/ 3 | logs/ 4 | logfile 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), 6 | and is generated by [Changie](https://github.com/miniscruff/changie). 7 | 8 | ## dbt-snowflake-query-tags 2.5.0 - May 15, 2024 9 | 10 | ### Features 11 | 12 | - Support custom extra kwarg for query tag meta ([#30](https://github.com/get-select/dbt-snowflake-query-tags/pull/30)) 13 | 14 | 15 | 16 | ## dbt-snowflake-query-tags 2.4.1 - May 14, 2024 17 | 18 | ### Fixes 19 | 20 | - Check for local_md5 as only added in dbt 1.4.0 ([#30](https://github.com/get-select/dbt-snowflake-query-tags/pull/30)) 21 | 22 | 23 | 24 | ## dbt-snowflake-query-tags 2.4.0 - May 14, 2024 25 | 26 | ### Features 27 | 28 | - Add raw_code_hash to query comment ([#26](https://github.com/get-select/dbt-snowflake-query-tags/pull/26)) 29 | - Add run_started_at to query comment ([#27](https://github.com/get-select/dbt-snowflake-query-tags/pull/27)) 30 | 31 | ### Contributors 32 | - [@bmoore813](https://github.com/bmoore813) (Features) 33 | - [@bisset-a](https://github.com/bisset-a) (Features) 34 | 35 | ## dbt-snowflake-query-tags 2.3.3 - January 29, 2024 36 | 37 | ### Features 38 | 39 | - Remove warning on session level query tag ([#22](https://github.com/get-select/dbt-snowflake-query-tags/pull/22)) 40 | 41 | 42 | 43 | ## dbt-snowflake-query-tags 2.3.2 - January 18, 2024 44 | 45 | ### Features 46 | 47 | - Support for query tags from profiles.yml and environment variables ([#21](https://github.com/get-select/dbt-snowflake-query-tags/pull/21)) 48 | - Add support for custom query comment keys and values ([#22](https://github.com/get-select/dbt-snowflake-query-tags/pull/22)) 49 | 50 | ### Contributors 51 | - [@maddoc1](https://github.com/maddoc1) (Features) 52 | 53 | 54 | ## dbt-snowflake-query-tags 2.3.1 - August 18, 2023 55 | 56 | ### Features 57 | 58 | - Handle non-mapping configs gracefully ([#17](https://github.com/get-select/dbt-snowflake-query-tags/pull/17)) 59 | 60 | 61 | 62 | ## dbt-snowflake-query-tags 2.3.0 - June 29, 2023 63 | 64 | ### Features 65 | 66 | - Add thread_id to query tag ([#16](https://github.com/get-select/dbt-snowflake-query-tags/pull/16)) 67 | 68 | 69 | 70 | ## dbt-snowflake-query-tags 2.2.0 - June 23, 2023 71 | 72 | ### Features 73 | 74 | - Add full_refresh, which and invocation_command to comment ([#15](https://github.com/get-select/dbt-snowflake-query-tags/pull/15)) 75 | 76 | 77 | 78 | ## dbt-snowflake-query-tags 2.1.0 - May 26, 2023 79 | 80 | ### Features 81 | 82 | - Add dbt meta to comment metadata ([#13](https://github.com/get-select/dbt-snowflake-query-tags/pull/13)) 83 | 84 | ### Contributors 85 | - [@pratik60](https://github.com/pratik60) (Features) 86 | 87 | 88 | ## dbt-snowflake-query-tags 2.0.2 - May 12, 2023 89 | 90 | ### Features 91 | 92 | - Support dbt 1.5.0 ([#11](https://github.com/get-select/dbt-snowflake-query-tags/pull/11)) 93 | 94 | 95 | 96 | ## dbt-snowflake-query-tags 2.0.1 - February 24, 2023 97 | 98 | ### Features 99 | 100 | - Add dbt tags to comment metadata ([#9](https://github.com/get-select/dbt-snowflake-query-tags/pull/9)) 101 | 102 | 103 | 104 | ## dbt-snowflake-query-tags 2.0.0 - February 24, 2023 105 | 106 | ### Fixes 107 | 108 | - Use query comments and query tags to avoid query tag character limit ([#8](https://github.com/get-select/dbt-snowflake-query-tags/pull/8)) 109 | 110 | 111 | 112 | ## dbt-snowflake-query-tags 1.1.3 - February 13, 2023 113 | 114 | ### Fixes 115 | 116 | - Dedupe refs ([#6](https://github.com/get-select/dbt-snowflake-query-tags/pull/6)) 117 | 118 | 119 | 120 | ## dbt-snowflake-query-tags 1.1.2 - February 13, 2023 121 | 122 | ### Features 123 | 124 | - Support dispatch order for macro configuration ([#2](https://github.com/get-select/dbt-snowflake-query-tags/pull/2)) 125 | 126 | ### Contributors 127 | - [@robscriva](https://github.com/robscriva) (Features) 128 | 129 | 130 | ## dbt-snowflake-query-tags 1.1.1 - February 12, 2023 131 | 132 | ### Fixes 133 | 134 | - Fix refs list ([#4](https://github.com/get-select/dbt-snowflake-query-tags/pull/4)) 135 | 136 | 137 | 138 | ## dbt-snowflake-query-tags 1.1.0 - February 11, 2023 139 | 140 | ### Features 141 | 142 | - Add node refs to tag ([#1](https://github.com/get-select/dbt-snowflake-query-tags/pull/1)) 143 | 144 | 145 | 146 | ## dbt-snowflake-query-tags 1.0.0 - February 08, 2023 147 | 148 | ### Features 149 | 150 | - Initial release 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 get-select 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dbt-snowflake-query-tags 2 | 3 | From the [SELECT](https://select.dev) team, a dbt package to automatically tag dbt-issued queries with informative metadata. This package uses both query comments and query tagging. 4 | 5 | An example query comment contains: 6 | 7 | ```json 8 | { 9 | "dbt_snowflake_query_tags_version": "2.3.2", 10 | "app": "dbt", 11 | "dbt_version": "1.4.0", 12 | "project_name": "my_project", 13 | "target_name": "dev", 14 | "target_database": "dev", 15 | "target_schema": "dev", 16 | "invocation_id": "4ffa20a1-5d90-4a27-a58a-553bb6890f25", 17 | "node_refs": [ 18 | "model_b", 19 | "model_c" 20 | ], 21 | "node_name": "model_a", 22 | "node_alias": "model_a", 23 | "node_package_name": "my_project", 24 | "node_original_file_path": "models/model_a.sql", 25 | "node_database": "dev", 26 | "node_schema": "dev", 27 | "node_id": "model.my_project.model_a", 28 | "node_resource_type": "model", 29 | "node_tags": ["tag_1", "tag_2"], 30 | "node_meta": {"owner": "@alice", "model_maturity": "in dev"}, 31 | "materialized": "incremental", 32 | "full_refresh": false, 33 | "which": "run" 34 | 35 | -- dbt Cloud only 36 | "dbt_cloud_project_id": "146126", 37 | "dbt_cloud_job_id": "184124", 38 | "dbt_cloud_run_id": "107122910", 39 | "dbt_cloud_run_reason_category": "other", 40 | "dbt_cloud_run_reason": "Kicked off from UI by niall@select.dev", 41 | } 42 | ``` 43 | 44 | Query tags are used solely for attaching the `is_incremental` flag, as this isn't available to the query comment: 45 | 46 | ```json 47 | { 48 | "dbt_snowflake_query_tags_version": "2.3.2", 49 | "app": "dbt", 50 | "is_incremental": true 51 | } 52 | ``` 53 | 54 | ## Quickstart 55 | 56 | 1. Add this package to your `packages.yml` file, then install it with `dbt deps`. 57 | 58 | ```yaml 59 | packages: 60 | - package: get-select/dbt_snowflake_query_tags 61 | version: [">=2.0.0", "<3.0.0"] 62 | ``` 63 | 64 | 2. Adding the query tags 65 | 66 | 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: 67 | 68 | ```sql 69 | {% macro set_query_tag() -%} 70 | {% do return(dbt_snowflake_query_tags.set_query_tag()) %} 71 | {% endmacro %} 72 | 73 | {% macro unset_query_tag(original_query_tag) -%} 74 | {% do return(dbt_snowflake_query_tags.unset_query_tag(original_query_tag)) %} 75 | {% endmacro %} 76 | ``` 77 | 78 | Option 2: If running dbt >= 1.2, simply configure the dispatch search order in `dbt_project.yml`. 79 | 80 | ```yaml 81 | dispatch: 82 | - macro_namespace: dbt 83 | search_order: 84 | - 85 | - dbt_snowflake_query_tags 86 | - dbt 87 | ``` 88 | 89 | 3. To configure the query comments, add the following config to `dbt_project.yml`. 90 | 91 | ```yaml 92 | query-comment: 93 | comment: '{{ dbt_snowflake_query_tags.get_query_comment(node) }}' 94 | append: true # Snowflake removes prefixed comments. 95 | ``` 96 | 97 | That's it! All dbt-issued queries will now be tagged. 98 | 99 | ## Adding additional metadata 100 | 101 | ### Query comments 102 | 103 | #### Meta and tag model configs 104 | 105 | Both [meta](https://docs.getdbt.com/reference/resource-configs/meta) and [tag](https://docs.getdbt.com/reference/resource-configs/tags) configs are automatically added to the query comments. 106 | 107 | #### 'extra' kwarg 108 | 109 | To add arbitrary keys and values to the comments, you can use the `extra` kwarg when calling `dbt_snowflake_query_tags.get_query_comment`. For example, to add a `run_started_at` key and value to the comment, we can do: 110 | 111 | ```yaml 112 | query-comment: 113 | comment: '{{ dbt_snowflake_query_tags.get_query_comment(node, extra={"run_started_at": builtins.run_started_at | string }) }}' 114 | append: true # Snowflake removes prefixed comments. 115 | ``` 116 | 117 | #### Adding env vars to query comments 118 | 119 | Here's an example of how you can add environment variables into the query comment: 120 | 121 | ```sql 122 | query-comment: 123 | comment: > 124 | {{ dbt_snowflake_query_tags.get_query_comment( 125 | node, 126 | extra={ 127 | 'CI_PIPELINE_ID': env_var('CI_PIPELINE_ID'), 128 | 'CI_JOB_NAME': env_var('CI_JOB_NAME'), 129 | 'CI_COMMIT_REF_NAME': env_var('CI_COMMIT_REF_NAME'), 130 | 'CI_RUNNER_TAGS': env_var('CI_RUNNER_TAGS') 131 | } 132 | ) }} 133 | append: true # Snowflake removes prefixed comments. 134 | ``` 135 | 136 | ### Query tags 137 | 138 | To extend the information added in the query tags, there are a few options: 139 | 140 | #### Model config 141 | 142 | Set the [query_tag](https://docs.getdbt.com/reference/resource-configs/snowflake-configs#query-tags) config value to a mapping type. Example: 143 | 144 | Model 145 | ```sql 146 | {{ config( 147 | query_tag = {'team': 'data'} 148 | ) }} 149 | 150 | select ... 151 | ``` 152 | 153 | Results in the following query tag. The additional information is added by this package. 154 | ``` 155 | '{"team": "data", "app": "dbt", "dbt_snowflake_query_tags_version": "2.3.2", "is_incremental": true}' 156 | ``` 157 | 158 | Note that using a non-mapping type in the `query_tag` config will result in a warning, and the config being ignored. 159 | 160 | Model 161 | ```sql 162 | {{ config( 163 | query_tag = 'data team' 164 | ) }} 165 | 166 | select ... 167 | ``` 168 | 169 | Warning: 170 | ``` 171 | dbt-snowflake-query-tags warning: the query_tag config value of 'data team' is not a mapping type, so is being ignored. If you'd like to add additional query tag information, use a mapping type instead, or remove it to avoid this message. 172 | ``` 173 | 174 | #### Profiles.yml 175 | 176 | Additionally, you can set the `query_tag` value in the `profiles.yml`. This must be a valid mapping, not a string. 177 | 178 | profiles.yml 179 | ```yml 180 | default: 181 | outputs: 182 | dev: 183 | +query_tag: 184 | team: data 185 | ... 186 | target: dev 187 | ``` 188 | 189 | #### Environment variables 190 | 191 | Another option is to use the optional project variable `env_vars_to_query_tag_list` to provide a list of environment variables to pull query tag values from. 192 | 193 | Example: 194 | 195 | dbt_project.yml: 196 | ```yml 197 | vars: 198 | env_vars_to_query_tag_list: ['TEAM','JOB_NAME'] 199 | ``` 200 | 201 | Results in a final query tag of 202 | ``` 203 | '{"team": "data", "job_name": "daily", "app": "dbt", "dbt_snowflake_query_tags_version": "2.3.2", "is_incremental": true}' 204 | ``` 205 | 206 | #### 'extra' kwarg 207 | 208 | Like the query comment macro, the query tag macro also supports an 'extra' kwarg. To make use of it, you'll need to configure this package following the dbt < 1.2 instructions. Then you can add any logic you like for additional query tag metadata in `query_tags.sql`. 209 | 210 | ``` 211 | {% macro set_query_tag() -%} 212 | {% do return(dbt_snowflake_query_tags.set_query_tag( 213 | extra={ 214 | 'custom_config_property': config.get('custom_config_property'), 215 | } 216 | )) %} 217 | {% endmacro %} 218 | 219 | {% macro unset_query_tag(original_query_tag) -%} 220 | {% do return(dbt_snowflake_query_tags.unset_query_tag(original_query_tag)) %} 221 | {% endmacro %} 222 | ``` 223 | 224 | ## Contributing 225 | 226 | ### Adding a CHANGELOG Entry 227 | We use changie to generate CHANGELOG entries. Note: Do not edit the CHANGELOG.md directly. Your modifications will be lost. 228 | 229 | Follow the steps to [install changie](https://changie.dev/guide/installation/) for your system. 230 | 231 | Once changie is installed and your PR is created, simply run `changie new` and changie will walk you through the process of creating a changelog entry. Commit the file that's created and your changelog entry is complete! 232 | -------------------------------------------------------------------------------- /dbt_project.yml: -------------------------------------------------------------------------------- 1 | name: 'dbt_snowflake_query_tags' 2 | version: '2.5.0' 3 | config-version: 2 4 | -------------------------------------------------------------------------------- /integration_tests/dbt_project.yml: -------------------------------------------------------------------------------- 1 | name: 'dbt_snowflake_query_tags_tests' 2 | version: '1.0.0' 3 | config-version: 2 4 | 5 | profile: integration_tests 6 | 7 | 8 | dispatch: 9 | - macro_namespace: dbt 10 | search_order: 11 | - dbt_snowflake_query_tags_tests 12 | - dbt_snowflake_query_tags 13 | - dbt 14 | 15 | query-comment: 16 | comment: '{{ dbt_snowflake_query_tags.get_query_comment(node, extra={"run_started_at": builtins.run_started_at | string }) }}' 17 | append: true # Snowflake removes prefixed comments. 18 | -------------------------------------------------------------------------------- /integration_tests/models/materialized_ephemeral.sql: -------------------------------------------------------------------------------- 1 | {{ config(materialized='ephemeral') }} 2 | 3 | select 1 as a 4 | -------------------------------------------------------------------------------- /integration_tests/models/materialized_incremental.sql: -------------------------------------------------------------------------------- 1 | {{ config(materialized='incremental', tags=['a', 'b', 'c'], query_tag={'test': 'test'}) }} 2 | 3 | select 1 as a 4 | 5 | -- {{ ref('materialized_table') }} 6 | -- {{ ref('materialized_view') }} 7 | -------------------------------------------------------------------------------- /integration_tests/models/materialized_table.sql: -------------------------------------------------------------------------------- 1 | {{ 2 | config( 3 | meta={ 4 | "owner": "@alice", 5 | "model_maturity": "in dev" 6 | }, 7 | materialized="table", 8 | tags='a', 9 | query_tag="this will generate a warning" 10 | ) 11 | }} 12 | 13 | select 1 as a 14 | -------------------------------------------------------------------------------- /integration_tests/models/materialized_view.sql: -------------------------------------------------------------------------------- 1 | {{ config(materialized='view') }} 2 | 3 | select 1 as a 4 | -------------------------------------------------------------------------------- /integration_tests/packages.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | - local: ../ 3 | -------------------------------------------------------------------------------- /integration_tests/profiles.yml: -------------------------------------------------------------------------------- 1 | # HEY! This file is used in the dbt-snowflake-query-tags integrations tests with GitHub Actions. 2 | # You should __NEVER__ check credentials into version control. Thanks for reading :) 3 | 4 | config: 5 | send_anonymous_usage_stats: False 6 | use_colors: True 7 | 8 | integration_tests: 9 | target: snowflake 10 | outputs: 11 | snowflake: 12 | # type: snowflake 13 | # account: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_ACCOUNT') }}" 14 | # user: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_USER') }}" 15 | # password: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_PASSWORD') }}" 16 | # role: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_ROLE') }}" 17 | # database: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_DATABASE') }}" 18 | # warehouse: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_TEST_WAREHOUSE') }}" 19 | # schema: dbt_snowflake_query_tags_test_commit_{{ env_var('GITHUB_SHA_OVERRIDE', '') if env_var('GITHUB_SHA_OVERRIDE', '') else env_var('GITHUB_SHA') }} 20 | # threads: 8 21 | 22 | snowflake: 23 | type: "snowflake" 24 | account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}" 25 | user: "{{ env_var('SNOWFLAKE_USER') }}" 26 | password: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_PASS') }}" 27 | role: "{{ env_var('SNOWFLAKE_ROLE') }}" 28 | database: "{{ env_var('SNOWFLAKE_DATABASE') }}" 29 | warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE') }}" 30 | schema: "{{ env_var('SNOWFLAKE_SCHEMA') }}" 31 | threads: 10 32 | -------------------------------------------------------------------------------- /integration_tests/seeds/test_seed.csv: -------------------------------------------------------------------------------- 1 | MONTH,SERVICE,SPEND 2 | 2022-04-01,Storage,1.136266305 3 | 2022-04-01,Compute,912.772222176 4 | 2022-04-01,Adj For Incl Cloud Services,-74.921528302 5 | 2022-04-01,Cloud Services,74.921528302 6 | 2022-04-01,Automatic Clustering,0.051113362 7 | -------------------------------------------------------------------------------- /integration_tests/snapshots/snapshot.sql: -------------------------------------------------------------------------------- 1 | {% snapshot test_snapshot %} 2 | 3 | {{ 4 | config( 5 | target_schema=target.schema, 6 | strategy='check', 7 | unique_key='a', 8 | check_cols=['b'], 9 | ) 10 | }} 11 | 12 | select 1 as a, 2 as b 13 | 14 | {% endsnapshot %} 15 | -------------------------------------------------------------------------------- /integration_tests/tests/dbt_project_configured_meta/test_2.sql: -------------------------------------------------------------------------------- 1 | select 1 2 | where false 3 | -------------------------------------------------------------------------------- /integration_tests/tests/test.sql: -------------------------------------------------------------------------------- 1 | {{ config(meta = { 2 | 'team': '1' 3 | }) }} 4 | 5 | select 1 6 | where false 7 | -------------------------------------------------------------------------------- /macros/query_comment.sql: -------------------------------------------------------------------------------- 1 | {% macro get_query_comment(node, extra = {}) %} 2 | {%- set comment_dict = extra -%} 3 | {%- do comment_dict.update( 4 | app='dbt', 5 | dbt_snowflake_query_tags_version='2.5.0', 6 | dbt_version=dbt_version, 7 | project_name=project_name, 8 | target_name=target.name, 9 | target_database=target.database, 10 | target_schema=target.schema, 11 | invocation_id=invocation_id, 12 | run_started_at=run_started_at.astimezone(modules.pytz.utc).isoformat(), 13 | full_refresh=flags.FULL_REFRESH, 14 | which=flags.WHICH, 15 | ) -%} 16 | 17 | {%- if node is not none -%} 18 | {%- do comment_dict.update( 19 | node_name=node.name, 20 | node_alias=node.alias, 21 | node_package_name=node.package_name, 22 | node_original_file_path=node.original_file_path, 23 | node_database=node.database, 24 | node_schema=node.schema, 25 | node_id=node.unique_id, 26 | node_resource_type=node.resource_type, 27 | node_meta=node.config.meta, 28 | node_tags=node.tags, 29 | ) -%} 30 | 31 | {%- if flags.INVOCATION_COMMAND -%} 32 | {%- do comment_dict.update( 33 | invocation_command=flags.INVOCATION_COMMAND 34 | ) -%} 35 | {%- endif -%} 36 | 37 | {%- if node.resource_type != ('seed') -%} {# Otherwise this throws an error saying 'Seeds cannot depend on other nodes.' #} 38 | {%- if node.refs is defined -%} 39 | {% set refs = [] %} 40 | {% for ref in node.refs %} 41 | {%- if dbt_version >= '1.5.0' -%} 42 | {%- do refs.append(ref.name) -%} 43 | {%- else -%} 44 | {%- do refs.append(ref[0]) -%} 45 | {%- endif -%} 46 | {% endfor %} 47 | {%- do comment_dict.update( 48 | node_refs=refs | unique | list 49 | ) -%} 50 | {%- endif -%} 51 | {%- endif -%} 52 | {%- if node.resource_type == 'model' -%} 53 | {%- do comment_dict.update( 54 | materialized=node.config.materialized, 55 | ) -%} 56 | {%- endif -%} 57 | 58 | {%- if node.raw_code is not none and local_md5 -%} 59 | {%- do comment_dict.update({ 60 | "raw_code_hash": local_md5(node.raw_code) 61 | }) -%} 62 | {%- endif -%} 63 | {%- endif -%} 64 | 65 | {%- if env_var('DBT_CLOUD_PROJECT_ID', False) -%} 66 | {%- do comment_dict.update( 67 | dbt_cloud_project_id=env_var('DBT_CLOUD_PROJECT_ID') 68 | ) -%} 69 | {%- endif -%} 70 | 71 | {%- if env_var('DBT_CLOUD_JOB_ID', False) -%} 72 | {%- do comment_dict.update( 73 | dbt_cloud_job_id=env_var('DBT_CLOUD_JOB_ID') 74 | ) -%} 75 | {%- endif -%} 76 | 77 | {%- if env_var('DBT_CLOUD_RUN_ID', False) -%} 78 | {%- do comment_dict.update( 79 | dbt_cloud_run_id=env_var('DBT_CLOUD_RUN_ID') 80 | ) -%} 81 | {%- endif -%} 82 | 83 | {%- if env_var('DBT_CLOUD_RUN_REASON_CATEGORY', False) -%} 84 | {%- do comment_dict.update( 85 | dbt_cloud_run_reason_category=env_var('DBT_CLOUD_RUN_REASON_CATEGORY') 86 | ) -%} 87 | {%- endif -%} 88 | 89 | {%- if env_var('DBT_CLOUD_RUN_REASON', False) -%} 90 | {%- do comment_dict.update( 91 | dbt_cloud_run_reason=env_var('DBT_CLOUD_RUN_REASON') 92 | ) -%} 93 | {%- endif -%} 94 | 95 | {{ return(tojson(comment_dict)) }} 96 | {% endmacro %} 97 | -------------------------------------------------------------------------------- /macros/query_tags.sql: -------------------------------------------------------------------------------- 1 | {% macro set_query_tag(extra = {}) -%} 2 | {{ return(adapter.dispatch('set_query_tag', 'dbt_snowflake_query_tags')(extra=extra)) }} 3 | {%- endmacro %} 4 | 5 | {% macro default__set_query_tag(extra = {}) -%} 6 | {# Get session level query tag #} 7 | {% set original_query_tag = get_current_query_tag() %} 8 | {% set original_query_tag_parsed = {} %} 9 | 10 | {% if original_query_tag %} 11 | {% if fromjson(original_query_tag) is mapping %} 12 | {% set original_query_tag_parsed = fromjson(original_query_tag) %} 13 | {% endif %} 14 | {% endif %} 15 | 16 | {# The env_vars_to_query_tag_list should contain an environment variables list to construct query tag dict #} 17 | {% set env_var_query_tags = {} %} 18 | {% if var('env_vars_to_query_tag_list', '') %} {# Get a list of env vars from env_vars_to_query_tag_list variable to add additional query tags #} 19 | {% for k in var('env_vars_to_query_tag_list') %} 20 | {% set v = env_var(k, '') %} 21 | {% do env_var_query_tags.update({k.lower(): v}) if v %} 22 | {% endfor %} 23 | {% endif %} 24 | 25 | {# Start with any model-configured dict #} 26 | {% set query_tag = config.get('query_tag', default={}) %} 27 | 28 | {% if query_tag is not mapping %} 29 | {% do log("dbt-snowflake-query-tags warning: the query_tag config value of '{}' is not a mapping type, so is being ignored. If you'd like to add additional query tag information, use a mapping type instead, or remove it to avoid this message.".format(query_tag), True) %} 30 | {% set query_tag = {} %} {# If the user has set the query tag config as a non mapping type, start fresh #} 31 | {% endif %} 32 | 33 | {% do query_tag.update(original_query_tag_parsed) %} 34 | {% do query_tag.update(env_var_query_tags) %} 35 | {% do query_tag.update(extra) %} 36 | 37 | {%- do query_tag.update( 38 | app='dbt', 39 | dbt_snowflake_query_tags_version='2.5.0', 40 | ) -%} 41 | 42 | {% if thread_id %} 43 | {%- do query_tag.update( 44 | thread_id=thread_id 45 | ) -%} 46 | {% endif %} 47 | 48 | 49 | {# We have to bring is_incremental through here because its not available in the comment context #} 50 | {% if model.resource_type == 'model' %} 51 | {%- do query_tag.update( 52 | is_incremental=is_incremental() 53 | ) -%} 54 | {% endif %} 55 | 56 | {% set query_tag_json = tojson(query_tag) %} 57 | {{ log("Setting query_tag to '" ~ query_tag_json ~ "'. Will reset to '" ~ original_query_tag ~ "' after materialization.") }} 58 | {% do run_query("alter session set query_tag = '{}'".format(query_tag_json)) %} 59 | {{ return(original_query_tag)}} 60 | {% endmacro %} 61 | 62 | {% macro unset_query_tag(original_query_tag) -%} 63 | {{ return(adapter.dispatch('unset_query_tag', 'dbt_snowflake_query_tags')(original_query_tag)) }} 64 | {%- endmacro %} 65 | 66 | {% macro default__unset_query_tag(original_query_tag) -%} 67 | {% if original_query_tag %} 68 | {{ log("Resetting query_tag to '" ~ original_query_tag ~ "'.") }} 69 | {% do run_query("alter session set query_tag = '{}'".format(original_query_tag)) %} 70 | {% else %} 71 | {{ log("No original query_tag, unsetting parameter.") }} 72 | {% do run_query("alter session unset query_tag") %} 73 | {% endif %} 74 | {% endmacro %} 75 | -------------------------------------------------------------------------------- /supported_adapters.env: -------------------------------------------------------------------------------- 1 | SUPPORTED_ADAPTERS=snowflake 2 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | skipsdist = True 3 | envlist = snowflake 4 | 5 | [testenv] 6 | passenv = 7 | DBT_PROFILES_DIR 8 | GITHUB_SHA 9 | GITHUB_SHA_OVERRIDE 10 | SNOWFLAKE_ACCOUNT 11 | SNOWFLAKE_USER 12 | DBT_ENV_SECRET_SNOWFLAKE_PASS 13 | SNOWFLAKE_ROLE 14 | SNOWFLAKE_DATABASE 15 | SNOWFLAKE_WAREHOUSE 16 | SNOWFLAKE_SCHEMA 17 | 18 | [testenv:snowflake] 19 | changedir = integration_tests 20 | deps = dbt-snowflake~=1.5.0 21 | commands = 22 | dbt deps 23 | dbt build --full-refresh 24 | dbt build 25 | 26 | # Snowflake integration tests for centralized dbt testing 27 | # run dbt commands directly, assumes dbt is already installed in environment 28 | [testenv:dbt_integration_snowflake] 29 | changedir = integration_tests 30 | allowlist_externals = 31 | dbt 32 | skip_install = true 33 | commands = 34 | dbt deps 35 | dbt build --full-refresh --no-version-check 36 | dbt build --no-version-check --------------------------------------------------------------------------------