dbt-data-reliability icon indicating copy to clipboard operation
dbt-data-reliability copied to clipboard

feat; add deprecation_date key to dbt_models metadata model

Open scrambldchannel opened this issue 7 months ago β€’ 4 comments

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, and access. These additions enhance model metadata tracking and capture additional configuration properties from dbt graph sources.

scrambldchannel avatar Apr 15 '26 09:04 scrambldchannel

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.sql
  • models/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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Apr 15 '26 09:04 coderabbitai[bot]

πŸ‘‹ @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.

github-actions[bot] avatar Apr 15 '26 09:04 github-actions[bot]

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.

github-actions[bot] avatar Jun 15 '26 02:06 github-actions[bot]

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.

github-actions[bot] avatar Jul 16 '26 02:07 github-actions[bot]