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_base_model to support arbitrary configs #127

Closed Chizbro closed 8 months ago

Chizbro commented 1 year ago

Describe the feature

extend generate_base_model to accept a dictionary parameter: configs (default to dict). This would be enumerated into a config block in the model. Similar to the current materialized parameter, but support arbitrary configs

Describe alternatives you've considered

These could be added manually or as a post-process but we're already generating base models in bulk with https://github.com/tuanchris/dbt-generator so would make sense to avoid an extra step

Additional context

I'm currently using this to provide an alias for base models. All bases and sources are in a common project so they can be leveraged by importing one project. When we have multiple instances of a source system we end up having to put that instance context in the model name, but in the database layer we'd prefer the instance context to be in the schema and the table name to be plain. Adding a configs parameter will allow us to use generator tools to provide the table name when generating the base model and also continue to support the existing materialized parameter. e.g model name = _customers, schema = , alias = customers

Who will this benefit?

Teams using tools like https://github.com/tuanchris/dbt-generator to bulk generate base models that need some greater control around the config of those models and don't want to do it as a second step

Are you interested in contributing this feature?

Absolutely. I've built a proof of concept that I'm already using

github-actions[bot] commented 9 months 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 8 months 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.