cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to import table , column descriptions into unity catalog?

prasad_vaze
New Contributor III

I have a spreadheet containing table & column descriptions (comments) 

Is there a way to upload this against the schema in unity catalog? 

Basically instead of running  'Alter table <> alter column <>  comment "description"  '  command for every column, is there an easy way to mass apply column comments in unity catalog schema? 

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz
Community Manager
Community Manager

Hi @prasad_vaze , Let’s explore how you can manage column comments in the Unity Catalog within Azure Databricks.

 

Unity Catalog Overview:

Adding Comments to Columns:

  • While there’s no direct “ALTER VIEW” command to add comments to specific columns in an existing view, you can recreate the view with the desired comments.
  • Here’s a workaround:
    • Create a new view with the same name as the existing one.
    • In the new view, include the desired comments for the columns you want to update.
    • Drop the old view and rename the new view to the original name.

Mass Applying Column Comments:

  • If you have a spreadsheet with column descriptions, consider these approaches:
    • Programmatic Solution:
      • Write a script (Python, Scala, etc.) that reads the spreadsheet and dynamically generates the necessary “ALTER TABLE” or “ALTER VIEW” commands for each column.
      • Execute these commands programmatically against your tables/views.
    • AI-Generated Comments:

Tagging and Organizing:

Remember, while altering views directly might not be possible due to limitations, creativity and scripting can help you achieve your desired outcome! 🚀

 


 

View solution in original post

1 REPLY 1

Kaniz
Community Manager
Community Manager

Hi @prasad_vaze , Let’s explore how you can manage column comments in the Unity Catalog within Azure Databricks.

 

Unity Catalog Overview:

Adding Comments to Columns:

  • While there’s no direct “ALTER VIEW” command to add comments to specific columns in an existing view, you can recreate the view with the desired comments.
  • Here’s a workaround:
    • Create a new view with the same name as the existing one.
    • In the new view, include the desired comments for the columns you want to update.
    • Drop the old view and rename the new view to the original name.

Mass Applying Column Comments:

  • If you have a spreadsheet with column descriptions, consider these approaches:
    • Programmatic Solution:
      • Write a script (Python, Scala, etc.) that reads the spreadsheet and dynamically generates the necessary “ALTER TABLE” or “ALTER VIEW” commands for each column.
      • Execute these commands programmatically against your tables/views.
    • AI-Generated Comments:

Tagging and Organizing:

Remember, while altering views directly might not be possible due to limitations, creativity and scripting can help you achieve your desired outcome! 🚀

 


 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.