Repository navigation
Add cursor.description type codes - #852
rnovatorov wants to merge 3 commits into
Conversation
CrateDB reports the type of every result column in `col_types`, but `Cursor.description` always reported `None` for the type code, forcing consumers to read the private `cursor._result`. Pass the wire value through unchanged: an integer for scalar columns, a nested list for arrays, `None` when `col_types` is absent, null, or short. Unknown identifiers pass through rather than raise. Fixes crate#837
|
Tick the box to add this pull request to the merge queue (same as
|
bgunebakan
left a comment
There was a problem hiding this comment.
Hi @rnovatorov,
Thank you for your contribution! I've added some comments.
rnovatorov
left a comment
There was a problem hiding this comment.
Hi @bgunebakan, thank you for the review. I didn't know type codes must be hashable - the pep doesn't mention it. If the recursive list->tuple conversion cuts this - I'll fix and test it.
rnovatorov
left a comment
There was a problem hiding this comment.
Hi @bgunebakan, I think I've fixed the issues, would you mind taking a look?
bgunebakan
left a comment
There was a problem hiding this comment.
Thank you for your contribution. One of the job is failing in the pipeline but it's because of the flaky test, looks like it's not related with PR changes.
|
@bgunebakan, @seut, thank you for the review. I've resolved the comments as I believe the mentioned issues are now fixed. Feel free to reopen if needed. How do you guys handle flaky tests? I'd allow the test to fail on v3.10 and create an issue to track it. This way we can merge the PR and call it a day. On the other hand 5 failures in a row on a single Python version and no failures before the PR is suspicious, so further research might be necessary. |
Populate
cursor.descriptiontype codes with raw wire values.Summary of the changes / Why this is an improvement
CrateDB reports the type of every result column in
col_types, butCursor.descriptionalways reportedNonefor the type code, forcing consumers to read the privatecursor._result.Pass the wire value through unchanged: an integer for scalar columns, a nested list for arrays,
Nonewhencol_typesis absent, null, or short. Unknown identifiers pass through rather than raise.Checklist