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

Fix postgres KeyError with missing explicit columns (#190) #482

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rsommer
Copy link

@rsommer rsommer commented Apr 1, 2022

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_map
fixes the error.

A simple testcase is added as well.

I did a simple test run using sqlite and postgres.

Roland Sommer and others added 3 commits April 1, 2022 12:42
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.
try:
idx, datatype = self._column_map[key]
except KeyError:
return self._row[key]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be setting raw to self._row[key] to ensure the processor runs on it still?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants