Leveraging invocation_args_dict for a query_comment

The problem I’m having

As per this recommendation, I am building a macro to use as a custom query_comment. I can’t seem to leverage the invocation_args_dict in this macro the way I do in other macros. The compilation context does not include invocation_args_dict in its list of accessible variables.

My questions are:

  1. Is there a way to include args in the query_comment? Not just command line args, but all args, the way invocation_args_dict captures them.
  2. Why do query_comment’s not allow you to leverage invocation_args_dict at this time?

The context of why I’m trying to do this

We want better visibility in our Redshift query logs - when we view query text right now, we don’t know what job a given model is a part of, which makes QAing a longer process than it should be.

What I’ve already tried

I’ve tried using node.invocation_args instead, but this doesn’t supply me the args I need // any args for most invocations.

Some example code or error messages

This is the macro that I have built that is failing due to invocation_args_dict.

{% macro query_comment(node) %}
    {%- set comment_dict = {} -%}
    {%- do comment_dict.update(
    ) -%}
    {%- if node is not none -%}
      {%- do comment_dict.update(
            "database": node.database,
            "schema": node.schema,
            "identifier": node.identifier
      ) -%}
    {% else %}
      {%- do comment_dict.update(node_id='internal') -%}
    {%- endif -%}
    {% do return(tojson(comment_dict)) %}
{% endmacro %}