Programmatically Update Table / Columns Descriptions in Unity Catalog Without Altering Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 06:15 AM
Currently, we must re-run our DLT pipelines anytime we want to add/modify a table or column description to unity catalog.
- Is this the only way to add/modify unity catalog descriptions?
- Is there functionality within databricks cli / sdk that we can leverage to programmatically update table or column descriptions?
- Is there an api like StatementExecutionAPI?
Is this feature on the product roadmap?
- Labels:
-
Unity Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 10:26 AM - edited 08-16-2024 10:29 AM
Comments for schemas and tables may be updated using SQL DDL statement COMMENT ON.
Comments for columns are updated using:
ALTER TABLE <table-name> ALTER COLUMN <column-name> COMMENT '<comment-text>';
The <column-name> for nested STRUCTS follows simple dotted notation. For example, a STRUCT for a person's physical address:
ALTER TABLE person ALTER COLUMN physical_address.postal_code
COMMENT 'Postal code for the person\'s physical address.';
Less obvious, the <column-name> for fields in ARRAY<STRUCT<>> requires additional keyword ".element". For example, an array of address STRUCTs that includes an "address use code" field:
ALTER TABLE person ALTER COLUMN address.element.use_code
COMMENT 'The address use code indicates either \'physical\' or \'mailing\' address.';
As of this writing, each ALTER COLUMN ... COMMENT requires an individual ALTER TABLE statement. The column comments cannot be chained together as a list of as clauses within ALTER TABLE.