z3z1ma / dbt-osmosis

Provides automated YAML management, a dbt server, streamlit workbench, and git-integrated dbt model output diff tools
https://z3z1ma.github.io/dbt-osmosis/
Apache License 2.0
456 stars 46 forks source link

[feat] case insensitivity #4

Closed hbwhbw closed 2 years ago

hbwhbw commented 2 years ago

In our environment people write everything in lower case including both the SQL and the YML. It looks like the SNOWFLAKE adapter consistently returns column names as upper case. Can you provide an option to ignore case in comparisons of column names between the YML version and the DB?

I "fixed" this locally by changing this line to read c.name.lower() in the obvious place: https://github.com/z3z1ma/dbt-osmosis/blob/05ed698a059f855556a0ef59ab3c9cb578ce680e/src/dbt_osmosis/main.py#L438

But you might instead want to keep that case and modify all the places where you compare columns to do a case insensitive comparison. Looks like you're using python sets for the different column lists. I don't know how you'd make them case insensitive, so just adding the lower() maybe as a configuration would be great.

kylebutler-sf commented 2 years ago

I think I'm running into the same issue? It's running this several times: describe table None

z3z1ma commented 2 years ago

I am going to mark this as resolved as my last commit has made column comparison case insensitive. Can you post another issue @kylebutler-sf with a stack trace and I am happy to take a look.