cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How do you add comment metadata to delta live tables?

AnaMocanu
Contributor

Hey all,

We've got a bunch of business objects we created as delta live tables. these are important as that's what business users will use in dashboards, genie rooms etc. We're trying to enrich the metadata for those but the option is greyed out and I can't find the right documentation for it.
I tried to do it via SQL adding comment at the end of the column and that's not supported. What's the best way to achieve this?

We got the ability to add comments and AI assist on regular tables, just not mat views. thank you!

AnaMocanu_0-1740084969911.png

 

7 REPLIES 7

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @AnaMocanu,

As of now, although you can add comments and use AI assistance for regular tables, the same functionality is not supported for materialized views directly via SQL or the Databricks UI. Let me check if there is a way of doing this and get back.

Any answer to this yet? I have been trying to do this and found that I can use schema to change add comments to columns. However, for values that I need to initialize at build time, like _meta_data.file_path and last_modified_date as F.current_timestamp() I can not seem to find a way to add comments.

joshuat
Contributor

@Alberto_Umana Bumping this request - this is an important feature for our users, and it's not clear how to do it.

Thanks for bumping it @joshuat ! 100% agree, super important feature - Without good metadata we won't make this work properly for our users.

ashraf1395
Honored Contributor

Hi There , You can add comment in the delta live tables either mv or streaming table in the tag - @Dlt.table()

@Dlt.table(

   comment = "Delta live tables comment"

)

Here is the syntax for sql : https://docs.databricks.com/aws/en/dlt-ref/dlt-sql-ref-create-materialized-view#syntax
Here is the syntax for python : https://docs.databricks.com/aws/en/dlt-ref/dlt-python-ref-table#syntax

joshuat
Contributor

Thanks, but that doesn't answer the question ashraf1395. OP's question was how to create/update the field comments in the Catalog GUI. 

Also note that I've populated the  `comment=` syntax in my Python DLT definition, but the table description or creation logic are not populated in the GUI. Additionally, Python docs don't support field comments. 

joshuat_0-1744896577453.png

 

Jere
New Contributor II

Solution that worked for me with materialized views created by DLT was to use the following syntax in SQL Editor in Databricks or run sql file with sql warehouse:

COMMENT ON COLUMN <catalog>.<schema>.<table>.<column> IS 'comment here'
 
This didn't work with spark.sql for me.