cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to update comments and constraints on Streaming Tables created by DLT outside the pipeline?

Nexusss7
New Contributor II

I have a Delta Live Tables (DLT) pipeline that creates a streaming table (e.g., dbrtdflite_catalog.demotest_silver.customer_profile).
I want to update table-level and column-level comments as well as constraints on this table.

When I try commands like:
COMMENT ON TABLE dbrtdflite_catalog.demotest_silver.customer_profile IS 'Customer profile data';
I get an error:
[STREAMING_TABLE_OPERATION_NOT_ALLOWED.INVALID_ALTER] The operation COMMENT ON TABLE is not allowed: To alter the schema or properties of Streaming Tables, please use the CREATE OR REFRESH command.

Even I have tried updating constraints but seems it's not allowed.

My requirement is to update comments/constraints outside of the DLT pipeline (without modifying the pipeline code).

- Is there any supported way to do this for DLT-managed streaming tables?
-  Or is the only option to make these changes inside the DLT pipeline definition itself?

Thanks in advance for your help! 

1 ACCEPTED SOLUTION

Accepted Solutions

Saritha_S
Databricks Employee
Databricks Employee

Hi @Nexusss7 

You can add a comment in the delta live tables, either the MV or the 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

 It is not currently supported to update comments or constraints for Delta Live Tables (DLT)-managed streaming tables outside the pipeline definition code. Any attempt to use standard SQL commands (COMMENT ON TABLEALTER TABLE ADD CONSTRAINT, etc.) on DLT streaming tables results in errors, as Databricks restricts altering DLT streaming tables this way for metadata integrity and pipeline management reasons.

View solution in original post

1 REPLY 1

Saritha_S
Databricks Employee
Databricks Employee

Hi @Nexusss7 

You can add a comment in the delta live tables, either the MV or the 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

 It is not currently supported to update comments or constraints for Delta Live Tables (DLT)-managed streaming tables outside the pipeline definition code. Any attempt to use standard SQL commands (COMMENT ON TABLEALTER TABLE ADD CONSTRAINT, etc.) on DLT streaming tables results in errors, as Databricks restricts altering DLT streaming tables this way for metadata integrity and pipeline management reasons.