Skip to content
Lucas Lessa
Voltar para as notícias
DatabricksGAImpacto: Médio

Query tags for Databricks SQL are now generally available

Use custom key-value tags on SQL workloads to group, filter, and track costs on warehouses and Lakehouse Real-Time compute.

O que mudou

Query tags allow you to attach custom key-value pairs to SQL workloads in Databricks. This makes it easier to group operations by business context, audit costs per team, and identify long-running queries directly from the system history. ### Use cases Imagine you need to audit how much each department spends on warehouse queries or track which queries originated from a specific dbt model. With tags, you can: - Group queries by team, project, or environment. - Track warehouse costs using custom metadata. - Identify the source of slow queries in the UI or system table. ### How to use You can define tags at the session or statement level using supported connectors or connection parameters. The following example shows how to use the Python connector to set tags in a session. python from databricks import sql import os with sql.connect( server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME"), http_path = os.getenv("DATABRICKS_HTTP_PATH"), access_token = os.getenv("DATABRICKS_TOKEN"), query_tags = {"team": "engineering", "dashboard": "abc123"} ) as connection: with connection.cursor() as cursor: cursor.execute("SELECT * FROM samples.nyctaxi.trips LIMIT 10") result = cursor.fetchall() What happens in this code: 1. The connection to Databricks SQL is established using environment variables. 2. The query_tags parameter injects key-value tags into the entire session. 3. The SQL statement executes and automatically inherits the configured tags. ### Limitations and requirements - Stage: Generally Available (GA). - Requirement: Access to the query_tags column in the system.query.history table. - Minimum version requirements for connectors and drivers (e.g., Python SDK 0.86.0 or Python Connector v4.1.3+). - Sensitive data: Because tags are stored as plain text, avoid including passwords or personally identifiable information.

Ver nota oficial do Databricks

Query tags for SQL warehouses are now generally available

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas