-
Notifications
You must be signed in to change notification settings - Fork 59
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
[CT-1519] Adding friendlier error message when dist is improperly set as a list or mapping #226
base: main
Are you sure you want to change the base?
[CT-1519] Adding friendlier error message when dist is improperly set as a list or mapping #226
Conversation
What's the best way to run integration tests against Redshift? It's a straightforward change but I don't think it can be tested on postgres |
@dbeatty10 do you know what can be done here? |
Thanks for tagging me @Fleid 🙌 @dluftspring Yes, the configuration is specific to Redshift and wouldn't make sense against Postgres 👍 The integration tests are located in the tests/ directory, and include a suite of Redshift-specific tests and overrides. There are two ways to run the integration tests against Redshift:
*One caveat to note is that first-time contributors to the dbt-redshift project will need a maintainer to approve their workflows in order for the CI tests to be run. This is to prevent malicious or unintended changes from being made to the project. Once your workflows have been approved by a maintainer, the CI tests will be automatically run whenever you push new commits to your branch. To get the party started, I'm going to click this button momentarily: In terms of creating a test that covers your case, I tried to look for a quick example of testing a compiler error. Here's a test that verifies a Writing new integration tests can be tricky sometimes, and we're happy to help with the details if needed! |
@Fleid potentially stupid question 😅 - how do I mark the PR ready for review? (apologies if that's in the contributing guide and I missed it) |
@dluftspring -- that's a good question, and I think you're already there! On GitHub, a pull request can be in one of several states. The relevant ones for this discussion are:
For pull requests in the draft state, you can use the "Ready for Review" button in the pull request interface: It looks like you did this, so you're good to go! 👍 Additionally, I just now applied a (We treat this label as a "private" one reserved for maintainers to add/remove rather that one a contributor should apply.) |
I have to figure out why adapter tests aren't running and I suspect it's because of a path exception that is out of date and needs to be changed on Main. I have to get back here at some point soon |
@@ -1,6 +1,10 @@ | |||
|
|||
{% macro dist(dist) %} | |||
{%- if dist is not none -%} | |||
{%- if dist is iterable or dist is mapping -%} | |||
{% exceptions.raise_compiler_error("Expected a single valued property for dist and got: " ~ dist ~ " instead") %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs a do
in front of it, e.g.:
{% do exceptions.raise_compiler_error("Expected a single valued property for dist and got: " ~ dist ~ " instead") %}
Alternatively, I think {{
instead of {%
also works:
{{ exceptions.raise_compiler_error("Expected a single valued property for dist and got: " ~ dist ~ " instead") }}
Otherwise jinja is looking for a keyword like set
, if
, macro
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's my mistake on the compiler error- it needs a do statement. Let me update this later today. There's an issue with the conditional check. Strings are technically iterable so this isn't doing what I want it to do in any case
@dluftspring I didn't research the possible reasons why, but there are a handful of tests that are failing CI checks:
|
You can ignore the materialized view test. That's a known flaky test. But the other three are consistently failing across python version and OS. |
This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days. |
This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days. |
resolves #224
Description
This PR adds a type check to the redshift adapters.sql
dist
macro and raises a compiler error if the user tries to set the single valued property as either a mapping or a list.Checklist
changie new
to create a changelog entry