dbt-labs / dbt-codegen

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

issue106/get_models helper macro #115

Closed erkanncelen closed 1 year ago

erkanncelen commented 1 year ago

resolves #

This is a:

All pull requests from community contributors should target the main branch (default).

Description & motivation

Added a helper macro named "get_models" in the macros/helpers section. The macro is used to get a list of all models with a specified prefix, in a specified directory.

Example: codegen.get_models(directory='marts', prefix='fct')

I mainly created this to make generate_model_yaml macro more powerful.

Example: codegen.generate_model_yaml( model_names = codegen.get_models(directory='marts', prefix='fct')

This way we can generate yamls for any set of models in our project.

Checklist

erkanncelen commented 1 year ago

You are right, I accepted the changes in readme.

And yes, apparently I forgot to delete | trims after I reworked the test.

All done! Thanks @joellabes