add select tags

This commit is contained in:
Jack Forgash 2023-09-07 15:41:50 -06:00
parent 63e63bc6b3
commit c725ad8160
3 changed files with 13 additions and 11 deletions

View File

@ -59,3 +59,14 @@ vars:
UPDATE_SNOWFLAKE_TAGS: True
MANUAL_FIX: False
OBSERV_FULL_TEST: False
dispatch:
- macro_namespace: dbt
search_order:
- osmosis-models
- dbt_snowflake_query_tags
- dbt
query-comment:
comment: '{{ dbt_snowflake_query_tags.get_query_comment(node) }}'
append: true # Snowflake removes prefixed comments.

View File

@ -1,11 +0,0 @@
{% macro set_query_tag() -%}
{% set new_json = {"repo":project_name, "object":this.table, "profile":target.profile_name, "env":target.name, "existing_tag":get_current_query_tag() } %}
{% set new_query_tag = tojson(new_json) | as_text %}
{% if new_query_tag %}
{% set original_query_tag = get_current_query_tag() %}
{{ log("Setting query_tag to '" ~ new_query_tag ~ "'. Will reset to '" ~ original_query_tag ~ "' after materialization.") }}
{% do run_query("alter session set query_tag = '{}'".format(new_query_tag)) %}
{{ return(original_query_tag)}}
{% endif %}
{{ return(none)}}
{% endmacro %}

View File

@ -5,3 +5,5 @@ packages:
version: 1.0.0
- git: https://github.com/FlipsideCrypto/fsc-utils.git
revision: "v1.3.0"
- package: get-select/dbt_snowflake_query_tags
version: [">=2.0.0", "<3.0.0"]