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

Make warn return empty string (#2222) #2259

Conversation

jeremyyeo
Copy link
Contributor

@jeremyyeo jeremyyeo commented Mar 27, 2020

resolves #2222

Description

Fixes the compilation of {{ exceptions.warn("thing") }} to return an empty string"" instead of None.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot
Copy link

cla-bot bot commented Mar 27, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Jeremy Yeo.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@beckjake
Copy link
Contributor

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Mar 27, 2020

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Jeremy Yeo.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot
Copy link

cla-bot bot commented Mar 27, 2020

The cla-bot has been summoned, and re-checked this pull request!

@jeremyyeo jeremyyeo force-pushed the fix/warn-exception-sql-compilation branch from dea83b6 to 11d62f6 Compare March 27, 2020 20:57
@cla-bot cla-bot bot added the cla:yes label Mar 27, 2020
@jeremyyeo
Copy link
Contributor Author

@beckjake is it necessary to add a test for this one?

Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

@jeremyyeo Thanks for your contribution!

Can you add an integration test so we can be sure we don't regress? There's an existing test that uses {% do exceptions.warn(...) %}. Can you update it to also do {{ exceptions.warn(...) }}? The file in question is at dbt/test/integration/013_context_var_tests/emit-warning-models/warning.sql. I don't think you'll have to update the Python at all, it should have the exact same pass/fail characteristics with the second warning.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
@beckjake
Copy link
Contributor

@beckjake is it necessary to add a test for this one?

What a timely question :)

@jeremyyeo
Copy link
Contributor Author

@jeremyyeo Thanks for your contribution!

Can you add an integration test so we can be sure we don't regress? There's an existing test that uses {% do exceptions.warn(...) %}. Can you update it to also do {{ exceptions.warn(...) }}? The file in question is at dbt/test/integration/013_context_var_tests/emit-warning-models/warning.sql. I don't think you'll have to update the Python at all, it should have the exact same pass/fail characteristics with the second warning.

Had thought of adding it into a separate .sql but figured it would work this way too... just adding it as a new line.

@jeremyyeo
Copy link
Contributor Author

Btw I have some errors when running make unit-test:

image

Recording: https://asciinema.org/a/VTmYWzD0TvAUO3aaJQh0R5Ell

@beckjake
Copy link
Contributor

beckjake commented Mar 27, 2020

@jeremyyeo you may find that rm -rf .tox helps! The next time you run it'll rebuild the environment. It looks like your local tests are potentially running against an old version of dbt.

This PR looks great to me, I'll kick off the rest of the tests and we'll get this merged, assuming everything passes.

@jeremyyeo jeremyyeo requested a review from beckjake March 30, 2020 04:24
@beckjake beckjake merged commit 78f1afa into dbt-labs:dev/octavius-catto Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

{{ exceptions.warn() }} returns None instead of an empty string
2 participants