-
Notifications
You must be signed in to change notification settings - Fork 112
Add missing psycopg2.extras import #399
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
Conversation
On some of our systems the `postgresql_query` task failed with the following error:
AttributeError: module 'psycopg2' has no attribute 'extras'
Applying the patch from this commit fixed the issue for me on those systems. This was previously reported in issue #283. However now that some time has passed, I am unable to reproduce the issue on our newer systems.
In any case, this is still a mistake that could cause problems in the future, so I think it would be better to fix it.
The reason that this mistake is not causing any actual errors in normal situations is because of how the python import system functions: All of the entrypoints (all the source files under plugins/modules) have an import for `psycopg2.extras`. This causes `extras` to be available on `psycopg2` for any code (in any module) that executes after that import statement, such as the function bodies in `module_utils/postgres.py`.
Fixes #283
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.
@Joris-van-der-Wel thanks for the PR! LGTM
Could you please add a changelog fragment so that our users will see your fix in the collection's changelog?
Fixes #283
(this ^ will automatically close the issue after the PR gets merged)
Thanks
hunleyd
left a comment
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.
pls re-request review once a changelog fragment has been added. thanks!
|
@Joris-van-der-Wel could you please take a look ^. If it's an issue for you, let us know, we merge it as-is and they will add the fragment ourselves |
Backport to stable-1: 💚 backport PR created✅ Backport PR branch: Backported as #405 🤖 @patchback |
|
@Joris-van-der-Wel thanks for the contribution! @hunleyd thanks for reviewing and mergin! @Joris-van-der-Wel if you're not on Matrix yet, you're welcome to join our room! |
SUMMARY
On some of our systems the
postgresql_querytask failed with the following error:Applying the patch from this commit fixed the issue for me on those systems. This was previously reported in issue #283. However now that some time has passed, I am unable to reproduce the issue on our newer systems.
In any case, this is still a mistake that could cause problems in the future, so I think it would be better to fix it.
The reason that this mistake is not causing any actual errors in normal situations is because of how the python import system functions: All of the entrypoints (all the source files under plugins/modules) have an import for
psycopg2.extras. This causesextrasto be available onpsycopg2for any code (in any module) that executes after that import statement, such as the function bodies inmodule_utils/postgres.py.ISSUE TYPE
COMPONENT NAME
community.postgresql
ADDITIONAL INFORMATION
Fixes #283