feat; add deprecation_date key to dbt_models metadata model
What
This is a quick attempt to address https://github.com/elementary-data/dbt-data-reliability/issues/986 by adding the column to the upload_dbt_models macro that populates the dbt_models model.
I've also added the new column, and several other missing columns, the properties for the model.
Why
We, and presumably others, leverage this column as a way to flag upcoming model deprecation to developers and also to automatically remove models from our project. If we could have this column in dbt_models, it would make analysis, and automated notifications to users easier. As far as I'm aware, there isn't a way to currently do this and I don't see a record of this being discussed previously.
TODO / Questions
~~I still need to do some testing but thought I might as well create a draft PR to accompany the issue I raised in case this is a non starter.~~
I've tested this locally and the resulting deprecation_date column picks up the value as expected. I've also run the integration tests against a postgres target successfully and will attach a log file.
I will do some functional testing against Snowflake using a branch in my repo too.
~~I also need to think about the appropriate data type to use for this column~~
I think leaving this as is the right approach but happy to be contradicted
Summary by CodeRabbit
- New Features
- Extended the dbt_models artifact table with seven new metadata fields:
deprecation_date,patch_path,metadata_hash,unique_key,incremental_strategy,group_name, andaccess. These additions enhance model metadata tracking and capture additional configuration properties from dbt graph sources.
- Extended the dbt_models artifact table with seven new metadata fields:
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3c653696-b388-4dd4-ac42-e466c200caee
π₯ Commits
Reviewing files that changed from the base of the PR and between 9f32d47faa00f77595d535619cdbc265d7f603c2 and 72a3b31b9f4e43bd3c9b53b1791c5ab226e7de34.
π Files selected for processing (2)
macros/edr/dbt_artifacts/upload_dbt_models.sqlmodels/dbt_artifacts.yml
π Walkthrough
Walkthrough
The dbt_models artifact is extended with seven new columns (patch_path, metadata_hash, unique_key, incremental_strategy, group_name, access, and deprecation_date). The SQL macro is updated to extract and include deprecation_date from model metadata, while the schema definition documents all new fields.
Changes
| Cohort / File(s) | Summary |
|---|---|
dbt_models artifact extension macros/edr/dbt_artifacts/upload_dbt_models.sql, models/dbt_artifacts.yml |
Added seven new columns to the dbt_models artifact schema (patch_path, metadata_hash, unique_key, incremental_strategy, group_name, access, deprecation_date). Updated flatten_model macro to extract deprecation_date from model metadata and include it in the flattened output. |
Estimated code review effort
π― 1 (Trivial) | β±οΈ ~5 minutes
Poem
π° Our dbt models grow more wise, With metadata in new disguise, Deprecation dates now stored with care, More details blooming everywhere! The artifacts dance with fresh new light, Our models' stories, ever bright. β¨
π₯ Pre-merge checks | β 3
β Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title accurately reflects the main change: adding a deprecation_date column to the dbt_models metadata. However, it contains a semicolon instead of a colon after 'feat', which is a stylistic issue that deviates from conventional commit format. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
β¨ Finishing Touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
π @scrambldchannel
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in the elementary repository.
This pull request is stale because it has been open for too long with no activity. If you would like the pull request to remain open, please remove the stale label or leave a comment.
This pull request was closed because it has been inactive for too long while being marked as stale. If you would like the pull request to reopen, please leave a comment.