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

fix: in star make excludes a list #418

Merged
merged 2 commits into from
Sep 16, 2021
Merged

Conversation

jasnonaz
Copy link
Contributor

@jasnonaz jasnonaz commented Sep 16, 2021

This is a:

  • [ X] 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

The feature added in 0.7.2 which allowed for star excludes to be case insensitive appears to have brought in an issue causing columns to get incorrectly dropped. #417

It looks like this is due to the |lower command turning a list into a string - this fixes that by looping over the columns to exclude and lowercasing them individually.

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)
    • [ X] 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

@jasnonaz jasnonaz changed the title make excludes a list fix: in star make excludes a list Sep 16, 2021
@clausherther
Copy link
Contributor

FYI, I think another way to do this with looping and explicitly creating a new list would be something like

set cols = cols | map("lower") | list
set except = except | map("lower") | list

@wuservices
Copy link

wuservices commented Sep 16, 2021

FYI, I think another way to do this with looping and explicitly creating a new list would be something like

set cols = cols | map("lower") | list
set except = except | map("lower") | list

@clausherther Is | list necessary?

Could you just change from |lower to |map('lower') i.e. from

{%- if col.column|lower not in except|lower -%}

to

{%- if col.column|lower not in except|map('lower') -%}

Playing around a little, this seems to work.

@jasnonaz jasnonaz merged commit fbe2167 into master Sep 16, 2021
@reidwil-jb
Copy link
Contributor

I appreciate the quick solutions on my first commit and subsequently first bug. 🐛

@joellabes joellabes deleted the fix-star-capitalization-object branch October 21, 2021 22:35
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.

5 participants