Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR - lowercase except values in star() #403

Merged
merged 4 commits into from
Aug 30, 2021
Merged

Conversation

reidwil-jb
Copy link
Contributor

@reidwil-jb reidwil-jb commented Aug 17, 2021

resolves #402

This is a:

  • bug fix PR with no breaking changes — please ensure the base branch is master
  • new functionality — please ensure the base branch is the latest dev/ branch
  • a breaking change — please ensure the base branch is the latest dev/ branch

Description & motivation

This PR allows a user to put their except values in whatever case they want when calling them within dbt_utils.star()

{{ dbt_utils.star(from=ref('my_model', except=["col_a","col_b"]) == {{ dbt_utils.star(from=ref('my_model', except=["COL_A","Col_B"])

Checklist

  • I have verified that these changes work locally on the following warehouses (Note: it's okay if you do not have access to all warehouses, this helps us understand what has been covered)
    • BigQuery
    • Postgres
    • Redshift
    • Snowflake
  • I have "dispatched" any new macro(s) so non-core adapters can also use them (e.g. the star() source)
  • I have updated the README.md (if applicable)
  • I have added tests & descriptions to my models (and macros if applicable)
  • I have added an entry to CHANGELOG.md

@reidwil-jb reidwil-jb marked this pull request as ready for review August 19, 2021 20:00
@ttusing
Copy link

ttusing commented Aug 24, 2021

I recently ran into something similar when using include in union_relations - my lowercase field names were excluded from not matching the uppercase version.

@reidwil-jb
Copy link
Contributor Author

@ttusing Makes sense - would you want to push the necessary changes to this PR?

@ttusing
Copy link

ttusing commented Aug 25, 2021

Hmm, it seems like this casing difficulty is likely to apply to every time columns are compared in Jinja. I wonder if the best way to fix this is to update all instances of column set comparisons. I'll move this discussion to the issue ticket and look over things a bit more.

@jasnonaz
Copy link
Contributor

Hi Reid - thank you so much for the fantastic PR!! I'm going to remove the comment that's no longer relevant than get this merged.

Copy link
Contributor

@jasnonaz jasnonaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work - thank you!!

@jasnonaz jasnonaz merged commit 5abb160 into dbt-labs:master Aug 30, 2021
@reidwil-jb reidwil-jb deleted the patch-1 branch August 30, 2021 14:38
@wuservices
Copy link

wuservices commented Sep 16, 2021

I think there's a bug here. I just upgraded and have a column missing.

Does except|lower convert a list to a string?

Before, I think something like this was running for me:
'seo_path' not in ['keywords', 'meta_description', 'seo_path_segment_keywords'] (True)

But now I think it may run as:
'seo_path' not in "['keywords', 'meta_description', 'seo_path_segment_keywords']" (False)

I was going to spend some more time looking at this tomorrow before filing an issue and repro as I'm pretty new to Python and Jinja, but wanted to share now in case this already sounds like this is the issue.

@EPNickBosma
Copy link

I think there's a bug here. I just upgraded and have a column missing.

We're noticing this too. I've written it up here.

@jasnonaz
Copy link
Contributor

Thanks for the heads up @wuservices @EPNickBosma

Can you check out #418 and let me know if this fixes the error you are seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Allow dbt_utils.star() except list to be an type of capitalization
5 participants