11-27-2023 05:47 AM
Hello,
I'm interested in the "Tags" feature of columns/schemas/tables of the UnityCatalog (described here: https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/tags)
I've been able to play with them by hand and would now like to integrate them from a programmatic perspective. I was able to QUERY them programmatically (described here https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/information-schema/column_tag... but not SET/UPDATE them programmatically.
I think it should be possible to set them programmatically according to the following paragraph in the documentation:
Currently, Azure Databricks supports tagging SQL commands with catalogs, schemas, tables (views, materialized views, streaming tables), and table columns. Learn more about the Databricks SQL tag commands at SQL language reference.
I've tried UPDATE statement on the information_schema.column_tags table, but get an spark error message:
SparkUnsupportedOperationException: UPDATE TABLE is not supported temporarily.
Any idea how I can set tags programmatically?
Thanks for your support,
Best
Antoine
12-18-2023 06:47 PM
Hi @afisl
Use following SQL command to add tags programmatically:
alter table <table_name>
set tags ('key1' = 'value1', 'key2' = 'value2')
11-27-2023 07:58 AM
Hi @afisl, Certainly! Let’s explore how you can set tags programmatically in the Unity Catalog within Azure Databricks.
Requirements and Constraints:
Managing Tags in Catalog Explorer (UI):
Retrieve Tag Information with Information Schema Tables:
Manage Tags with SQL Commands:
Using Tags for Search and Filtering:
Remember that this is a powerful way to organize and categorize your data assets within Unity Catalog. Happy tagging! 🏷️🌟
For more detailed information, refer to the official documentation.
11-28-2023 12:37 AM
Hi @Kaniz_Fatma ,
thanks for your answer. The documentation you quoted is exactly the one I saw.
But this paragraph is for me unclear:"
Manage Tags with SQL Commands:
I cannot find the Databricks SQL tag commands in the SQL language reference. Could you help me there please?
Thanks,
Antoine
11-28-2023 12:43 AM
Hi @afisl, Certainly! Let’s clarify that paragraph.
The Databricks SQL tag commands allow you to manage tags for various database objects within Databricks, including catalogs, schemas, tables (views, materialized views, streaming tables), and table columns. These tags serve as metadata labels that help organize and categorize your data assets.
Here are the key points about Databricks SQL tag commands:
Availability: This feature is available for Databricks Runtime versions 13.3 and above.
Usage: You can use Databricks SQL commands to apply and manage tags. These commands allow you to associate descriptive labels with your data objects, making it easier to search, filter, and organize them.
Where to Find Information: To learn more about the specific SQL commands related to tagging, refer to the SQL language reference provided by Databricks. This reference contains detailed information on how to use these commands effectively.
If you’re looking for the exact syntax and examples of tag-related SQL commands, I recommend checking the official Databricks SQL language reference. It provides comprehensive details on all supported commands, including those related to tagging.
Feel free to explore the reference documentation to gain a deeper understanding of how to work with tags in Databricks SQL! 🚀
12-18-2023 06:47 PM
Hi @afisl
Use following SQL command to add tags programmatically:
alter table <table_name>
set tags ('key1' = 'value1', 'key2' = 'value2')
07-23-2024 11:35 AM
is there a way to apply column tags programmatically to views?
01-30-2024 07:46 AM
Hi lets explore how AI in a comminication channel like this will expoenentially waste the time users use to craft their post and explain their issue or question.
I do not understand why a simple "I dont know, but I will find out" is out of range these days.
Sometimes we can make just as much or even more impact with simplicity without sending users in a loop or down the wrong rabbit hole, perfectly illustrated here by melbourne.
03-03-2024 08:17 PM
just confirming, that as at March 2024 you can use SQL to set/unset tags on:
But NOT on View Columns
however you CAN do this via the UI.
06-11-2024 03:56 AM
@afisl did you ever get down to the bottom of this? im trying to automatically set PI tags against column with certain words
3 weeks ago
Hi, running ALTER TABLE SET TAGS works on views too!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.
If there isn’t a group near you, start one and help create a community that brings people together.
Request a New Group