Home › Learn › Databricks interview prep › Tagging
Databricks interview prep · data engineering
Tagging: best practices and how organizations use tags
The four kinds of tags, how organizations use them for cost, ownership, classification and automation, and the practices that keep them useful.
Defaults, limits and preview status change often. Check the current Databricks docs before quoting a number.
Tag once at creation, and the rest follows.
Tag limits and propagation details vary by cloud; check the current Databricks and Azure documentation.
Kinds of tag
Four different things called tags
| Kind | Where | Used for |
|---|---|---|
| Compute tags | Clusters, pools, jobs, SQL warehouses, pipelines | Cost attribution; they propagate to cloud resources and appear in billing records (system.billing.usage) |
| Budget or usage policy tags | Serverless compute | The only way to attribute serverless spend |
| Cloud resource tags | Azure workspace, resource groups, storage accounts | Azure Cost Management, ownership, environment |
| Unity Catalog tags (including governed tags) | Catalogs, schemas, tables, columns | Classification (PII, sensitivity), domain, certification; can drive access policies and discovery |
Keep the two worlds apart: cost tags answer “who pays”, governance tags answer “what is this data and who may see it”.
How organizations use them
The common uses
| Use | Example tags | Enforced by |
|---|---|---|
| Chargeback and showback | cost_center, team, project | Cluster policy, budget policy, Azure Policy |
| Environment separation | environment = dev / test / prod | Bundles set it per target |
| Ownership and on-call | owner, contact, data_product | Policy requires it; alerts route by it |
| Budgets and anomaly alerts | cost_center, project | Budget alerts on tag totals |
| Workload type | workload = etl / bi / ml / adhoc | Jobs and warehouses set it |
| Automation | maintenance_tier = hot / warm / cold | Maintenance job reads the tag |
| Data classification | classification = pii / confidential | Governed tags, masks and policies |
| Lifecycle and cleanup | expires_on, created_by | A cleanup job finds stale resources |
| Compliance and audit | regulated = true, retention | Reports from system tables |
Best practices
What works
| Practice | Why |
|---|---|
| A small mandatory set (about five keys) | Teams will fill in five tags and ignore fifteen |
| Fixed keys and controlled values | Free text produces cost-center, CostCenter and costcenter |
| Enforce at creation, not afterwards | Cluster policies set or require tags; budget policies for serverless; Azure Policy for resources |
| Set them in code | Bundles and Terraform fill tags so nobody types them |
| Tag the job, not just the cluster | Shared and pooled compute otherwise hides who used it |
| Plan for shared compute | Decide how to split shared all-purpose clusters and pools (by user, by usage) |
| Tags are not retroactive | Past usage stays untagged; start early |
| Watch untagged spend | A dashboard and alert on usage with missing tags |
| No secrets or personal data in tags | Tags are visible in billing and APIs |
| Showback before chargeback | Show teams their cost for a quarter before charging it |
| Document the taxonomy and review it | Keys and values drift as the organization changes |
| Respect limits | Cloud resources have a maximum number and length of tags |
-- spend by team and environment, last 30 days
SELECT custom_tags['team'] AS team, custom_tags['environment'] AS env,
SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_date >= date_sub(current_date(), 30)
GROUP BY 1, 2
ORDER BY dbus DESC;Multiply by list prices from system.billing.list_prices for money. Rows with a null team are your untagged spend.
Practice
Questions to rehearse
- How do you attribute serverless cost to teams?
- How do you make sure every cluster is tagged?
- Cost tags versus governed tags: what is the difference?
- How would you charge back shared clusters?
- What would you do about the untagged spend you find on day one?
FAQ
Questions people ask
Can I tag after the fact?
Yes, but past usage stays untagged.
Do tags work for serverless?
Use budget or usage policies to attach tags to serverless usage.
Next
Where to go next
All Databricks interview topics · All data engineering · Databricks on this site