This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Fix postgres KeyError with missing explicit columns (#190)#482
Open
rsommer wants to merge 4 commits intoencode:masterfrom
Open
Fix postgres KeyError with missing explicit columns (#190)#482rsommer wants to merge 4 commits intoencode:masterfrom
rsommer wants to merge 4 commits intoencode:masterfrom
Conversation
If no explicit colum info is present, the postgres Record class causes a KeyError. Besides the given example in encode#190 this also happens if you construct the queries from text-clauses. Handling this the same way as if there is no entry in `self._column_map` fixes the error. A simple testcase is added as well.
zanieb
approved these changes
Jul 27, 2023
zanieb
reviewed
Jul 27, 2023
| try: | ||
| idx, datatype = self._column_map[key] | ||
| except KeyError: | ||
| return self._row[key] |
Contributor
There was a problem hiding this comment.
Should we be setting raw to self._row[key] to ensure the processor runs on it still?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If no explicit colum info is present, the postgres Record class causes a
KeyError. Besides the given example in #190 this also
happens if you construct the queries from text-clauses.
Handling this the same way as if there is no entry in
self._column_mapfixes the error.
A simple testcase is added as well.
I did a simple test run using sqlite and postgres.