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-28-2023 12:37 AM
Hi @Retired_mod ,
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
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
09-19-2024 08:43 AM
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