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

[CT-1519] [Bug] Better error message for misspecified dist key yaml config #651

Open
2 tasks done
dluftspring opened this issue Nov 16, 2022 · 4 comments · May be fixed by dbt-labs/dbt-redshift#226
Open
2 tasks done
Labels
good-first-issue Good for newcomers pkg:dbt-redshift Issue affects dbt-redshift

Comments

@dluftspring
Copy link

Is this a new bug in dbt-redshift?

  • I believe this is a new bug in dbt-redshift
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

If you set the dist key in a model.yml file like

version: 2
models:
  - name: a_real_table
    config:
      sort:
        - primary_key
        - foreign_key
      dist:
        - primary_key

dbt will throw the following error

list has no attribute strip

Which is generic and non descriptive of what the user should fix. The issue is that since dist keys can only be single valud properties it should be specified as dist: primary_key.

Expected Behavior

A better message that isn't exposing the underlying python machinery and indicates what the user should do to fix the issue e.g. Single valued properties cannot be specified as a list

Steps To Reproduce

See Current Behaviour. If you set up a model like that in any dbt project you will reproduce the error

Relevant log output

No response

Environment

- OS: Mac
- Python: 3.9
- dbt-core:
- dbt-redshift: 1.3.0

Additional Context

No response

@dluftspring dluftspring added type:bug Something isn't working as documented triage:product In Product's queue labels Nov 16, 2022
@github-actions github-actions bot changed the title [Bug] Better error message for misspecified dist key yaml config [CT-1519] [Bug] Better error message for misspecified dist key yaml config Nov 16, 2022
@dbeatty10 dbeatty10 self-assigned this Nov 22, 2022
@dbeatty10
Copy link
Contributor

@dluftspring thank you for noticing and reporting this!

You are spot-on with your assessment, and it definitely makes sense to proactively notice where the type of input is unexpected and indicate how to fix it.

I'm going to label this as a "good_first_issue" for a contributor to pick up.

Implementation suggestion

Raise an error at the beginning of this macro if dist is a list instead of a string:
https://github.com/dbt-labs/dbt-redshift/blob/717018aec33e3a04a74445cff2637bd0629ff196/dbt/include/redshift/macros/adapters.sql#L2-L14

@dbeatty10 dbeatty10 added good-first-issue Good for newcomers and removed triage:product In Product's queue labels Nov 22, 2022
@dbeatty10 dbeatty10 removed their assignment Nov 22, 2022
@dluftspring
Copy link
Author

If that's all that needs to be done I can contribute the fix for this

@dbeatty10
Copy link
Contributor

Awesome @dluftspring !

When you open up a PR for this, just add the following as the first line:

resolves dbt-labs/dbt-adapters#651

This will help the reviewer of the PR link back to this conversation.

@github-actions
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days.

@github-actions github-actions bot added the Stale Mark an issue or PR as stale, to be closed label May 22, 2023
@mikealfare mikealfare removed Stale Mark an issue or PR as stale, to be closed type:bug Something isn't working as documented labels Feb 8, 2024
@mikealfare mikealfare reopened this Feb 8, 2024
@mikealfare mikealfare added the pkg:dbt-redshift Issue affects dbt-redshift label Jan 15, 2025
@mikealfare mikealfare transferred this issue from dbt-labs/dbt-redshift Jan 23, 2025
mikealfare added a commit that referenced this issue Jan 23, 2025
* Update ddtrace requirement from ~=1.20 to ~=2.1

Updates the requirements on [ddtrace](https://github.com/DataDog/dd-trace-py) to permit the latest version.
- [Release notes](https://github.com/DataDog/dd-trace-py/releases)
- [Changelog](https://github.com/DataDog/dd-trace-py/blob/2.x/CHANGELOG.md)
- [Commits](DataDog/dd-trace-py@v1.20.0...v2.1.4)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add automated changelog yaml from template for bot PR

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Github Build Bot <[email protected]>
Co-authored-by: Mike Alfare <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Good for newcomers pkg:dbt-redshift Issue affects dbt-redshift
Projects
None yet
3 participants