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

Support for preserving case in `generate_source` #161

Closed azdoherty closed 6 months ago

azdoherty commented 6 months ago

Describe the feature

generate_source lowercases all returned column and dataset names, it would be nice if we had an option to preserve case. When you are using bigquery case matters, MyDataset is different from mydataset.

Describe alternatives you've considered

This is already an interface implemented partially in generate_base_model in the form of case_sensitive_cols so extending a similar functionality here seems to make the most sense. I considered writing a custom script to modify the results to replace names with the known correct cases but ended up doing it manually since it was only for a handful of databases

Additional context

It applies to at least bigquery, not sure about others

Who will this benefit?

It will mean this tool works out of the box for creating sources from existing tables, instead of needing to run it then modify the results

Are you interested in contributing this feature?

yes, and I would definitely need a hand at least getting told where to start

gwenwindflower commented 6 months ago

Duplicate of #140 so closing for now, getting ready to merge in a PR to fix this! Thanks for flagging!