dbt-labs / dbt-codegen

Macros that generate dbt code
https://hub.getdbt.com/dbt-labs/codegen/latest/
Apache License 2.0
459 stars 99 forks source link

Generate basic tests in model yaml #158

Closed octiva closed 2 weeks ago

octiva commented 6 months ago

Describe the feature

A clear and concise description of what you want to happen.

add a include_tests function that checks if each column passes the not_null or unique tests, and adds them if they do. We can look to extend to relationships & accepted_values in the future.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

We could do this outside of the codegen, eg. Do as suggested by just doing bad things to the yaml and running tests on columns.

Additional context

Is this feature database-specific? Which database(s) is/are relevant? Please include any other relevant context here.

Who will this benefit?

What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly.

Are you interested in contributing this feature?

Yeah I would be interested. I have recently contributed to astronomer-cosmos & dbt-athena.

If any main contributors want to suggest implementation details I would be keen. My TLDR thought is: run test for each test type (so we can extend if we want), if test passes, include it, if not, dont.

github-actions[bot] commented 3 weeks ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

github-actions[bot] commented 2 weeks ago

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.