- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2026 05:12 AM
I've been trying to see if there's a way to have metadata included in query logging in a similar way to query banding in Teradata, and I've come across the field query_tags in system.query.history. However, I can't find any reference to it in the Databricks documentation that explains how to populate it, I've only found mention of it in what looks like some third-party DBT documentation here:- Query Tags and Context | databricks/dbt-databricks | DeepWiki
Presumably if this is a Databricks feature leveraged by DBT, it must be running some SQL to set query tag values. Does anyone know what that syntax is?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2026 06:54 PM - edited 01-28-2026 06:55 PM
Hello @hobrob_ex ,
query_tags is a Databricks feature, but (as of the current docs) it’s not set via a SQL statement like Teradata query banding / Snowflake ALTER SESSION
A per the docs, you need to pass it via session configuration
from databricks import sql
with sql.connect(
server_hostname="...",
http_path="...",
access_token="...",
session_configuration={"query_tags": "team:engineering,dashboard:abc123,env:prod"}
) as conn:
with conn.cursor() as cur:
cur.execute("SELECT 1")
Doc link:https://docs.databricks.com/aws/en/dev-tools/python-sql-connector#query-tags
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2026 05:11 PM
Hello @hobrob_ex ! Good Day!
We now have the querytags feature available in Public Preview. Please find the docs here: https://docs.databricks.com/aws/en/sql/user/queries/query-tags
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2026 12:28 AM
Hey Anudeep, Good day to you too!
That's great news, setting the tags via SQL is just what I need! Out of interest, was that already in the pipeline or was it implemented as a response to my query?