-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for query tags from profiles.yml and environment variables #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening the PR @maddoc1!
Will let @NiallRees own the review.
Functionality wise seems like two helpful additions. My only concern is i'm not quite sure what the implications are of starting out by populating the query tag from the current values set in the session - will let Niall comment here.
@@ -11,6 +32,8 @@ | |||
{% set query_tag = {} %} {# If the user has set the query tag config as a non mapping type, start fresh #} | |||
{% endif %} | |||
|
|||
{% do query_tag.update(session_query_tag_json) %} | |||
{% do query_tag.update(env_var_query_tags) %} | |||
|
|||
{%- do query_tag.update( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NiallRees will defer this review to you
Co-authored-by: Ian Whitestone <[email protected]>
macros/query_tags.sql
Outdated
@@ -3,6 +3,27 @@ | |||
{%- endmacro %} | |||
|
|||
{% macro default__set_query_tag() -%} | |||
{# Get session level query tag #} | |||
{% set session_query_tag = get_current_query_tag() %} | |||
{% set session_query_tag_json = {} %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% set session_query_tag_json = {} %} | |
{% set session_query_tag_json = {} %} |
let's rename this to 'session_query_tag_parsed' because it's not json
once it's been fromjson
'd?
Currently, if I want to extend the query tags, only the ones from the model's config are added.
If I have a query tag in my connection profile in the
profiles.yml
file - they are ignored.I've added the support to fetch the query tag from
profiles.yml
file as well as from environment variables.The list of the environment variables to get the tags from is defined by a new project variable:
env_vars_to_query_tag_list
.