snowflake.snowpark.Session.append_query_tag

Session.append_query_tag(tag: str, separator: str = ',') None[source]

Appends a tag to the current query tag. The input tag is appended to the current sessions query tag with the given separator.

Parameters:
  • tag – The tag to append to the current query tag.

  • separator – The string used to separate values in the query tag.

Note

Assigning a value via session.query_tag will remove any appended query tags.

Example::
>>> session.query_tag = "tag1"
>>> session.append_query_tag("tag2")
>>> print(session.query_tag)
tag1,tag2
>>> session.query_tag = "new_tag"
>>> print(session.query_tag)
new_tag
Copy
Example::
>>> session.query_tag = ""
>>> session.append_query_tag("tag1")
>>> print(session.query_tag)
tag1
Copy
Example::
>>> session.query_tag = "tag1"
>>> session.append_query_tag("tag2", separator="|")
>>> print(session.query_tag)
tag1|tag2
Copy
Example::
>>> session.sql("ALTER SESSION SET QUERY_TAG = 'tag1'").collect()
[Row(status='Statement executed successfully.')]
>>> session.append_query_tag("tag2")
>>> print(session.query_tag)
tag1,tag2
Copy