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: 

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_Fatma
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_Fatma
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! 🚀

 


 

Connect with Databricks Users in Your Area

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