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

Incompatibility of Bitwise OR Dictionary Merge for Python < 3.9 #483

Closed
mrkre opened this issue Nov 1, 2023 · 5 comments
Closed

Incompatibility of Bitwise OR Dictionary Merge for Python < 3.9 #483

mrkre opened this issue Nov 1, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@mrkre
Copy link

mrkre commented Nov 1, 2023

Line 165 in dbt/adapters/athena/impl.py employs the bitwise OR (|) operator for dictionary merging:

config = LfTagsConfig(**(lf_tags_config | dict(inherited_tags=lf_inherited_tags)))

This syntax is supported in Python 3.9 and above, but leads to a TypeError in Python versions less than 3.9: TypeError: unsupported operand type(s) for |: 'dict' and 'dict'.

Perhaps a version agnostic dictionary merge approach can be taken?

config = LfTagsConfig(**{**lf_tags_config, **{"inherited_tags": lf_inherited_tags}})
@nicor88
Copy link
Contributor

nicor88 commented Nov 1, 2023

@mrkre good catch, as we have to support python 3.8, for now, we might need to do what you suggested.

Any reason why you are still on Python 3.8?

@mrkre
Copy link
Author

mrkre commented Nov 2, 2023

Was running dagster + dbt + dbt-athena, and dagster is on 3.8. However, that can be upgraded so it's a non-issue for me. Just caught me by surprise as my pipelines broke in production.

@nicor88
Copy link
Contributor

nicor88 commented Nov 2, 2023

Thanks for the context @mrkre , feel free to open a PR with your proposed changes.

@nicor88 nicor88 added the bug Something isn't working label Nov 2, 2023
@nicor88
Copy link
Contributor

nicor88 commented Nov 2, 2023

this issue should be covered by #487 because @svdimchenko refactored the implementation.
Correct me if I'm wrong.

@mrkre
Copy link
Author

mrkre commented Nov 2, 2023

this issue should be covered by #487 because @svdimchenko refactored the implementation. Correct me if I'm wrong.

Yes, #487 should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants