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

Allow default codegen macros to be overridden #147

Closed jeremyyeo closed 8 months ago

jeremyyeo commented 9 months ago

Describe the feature

Codegen macros don't currently dispatch - for example:

https://github.com/dbt-labs/dbt-codegen/blob/main/macros/generate_model_yaml.sql

Meaning users can't override them by adding their own default__generate_model_yaml macros in the root project and dispatching (https://docs.getdbt.com/reference/dbt-jinja-functions/dispatch).

Probably quite straightforward to add dispatching code to those default implementations.

Describe alternatives you've considered

Add your own equivalent macro to your root project generate_model_yaml and call it without the package namespace - i.e. {{ generate_model_yaml(...) }} vs {{ codegen.generate_model_yaml(...) }}.

Additional context

NA

Who will this benefit?

Users already using codegen who want to override the behaviour. Internal Slack: https://dbt-labs.slack.com/archives/C017GDLAF7D/p1700084705883869?thread_ts=1700072499.889719&cid=C017GDLAF7D

Are you interested in contributing this feature?