Open Amin-Siddique opened 2 months ago
This was initially not implemented due to issues I was having with materialized views and column comments; maybe this is no longer the case, and either way, I think it should work fine with STs. If you are interested in adding this, we would need to follow the pattern we use for other components of MV/ST so that we can detect when the dbt project changes relative to what is stored in Databricks.
Describe the feature
The feature adds the ability to automatically generate SQL column comments in Databricks Delta Live Tables (DLT). Specifically, it updates the
CREATE STREAMING TABLE
SQL generation to include column comments using theCOMMENT
clause, which can be pulled from the dbt column description metadata.This allows users to define meaningful metadata for their columns directly in dbt models and have those automatically applied as SQL column comments when creating streaming tables in Databricks.
Describe alternatives you've considered
Additional context
Here's an example of the newly implemented code:
The code leverages dbt metadata (
node.columns
) to automatically generate column comments during table creation. This ensures consistency and reduces manual overhead for managing schema documentation.Who will this benefit?
This feature will benefit:
Example Use Case: A team might have a dbt model that defines columns with descriptions. When they deploy this model to a Databricks Delta Live Table, the column comments would automatically be included, helping others understand the purpose and meaning of each column.
Additionally, we can also pull column constraints.
Are you interested in contributing this feature?
Yes, I'm interested in contributing to this feature. Please let me know if additional steps are required to prepare it for contribution or if any changes are needed. I am happy to discuss the implementation further.