-
Notifications
You must be signed in to change notification settings - Fork 177
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
Support UUID type #354
Support UUID type #354
Conversation
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.
Missing prepared statement handling
trino/client.py
Outdated
try: | ||
return uuid.UUID(values) | ||
except: | ||
return None |
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.
Why the exception handling, I don't think we would like to silently discard values.
try: | |
return uuid.UUID(values) | |
except: | |
return None | |
return uuid.UUID(values) |
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.
The test currently expects that CAST(NULL AS UUID)
returns None
in Python. Should we expect a different behavior or a specific case should be applied when values
is None
?
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.
I get it but we should not let None
go into UUID, similar like all the other mappers.
@@ -1,5 +1,6 @@ | |||
import math | |||
import re | |||
import uuid |
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.
import uuid | |
from uuid import UUID |
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.
The reason why I did this is because I saw elsewhere in the code was importing uuid instead of uuid.UUID
. But I can change this.
64e9ec5
to
c67655c
Compare
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.
LGTM % minor comment
trino/client.py
Outdated
@@ -1185,6 +1186,13 @@ def map(self, values: Any) -> Optional[Dict[Any, Optional[Any]]]: | |||
} | |||
|
|||
|
|||
class UuidValueMapper(ValueMapper[uuid.UUID]): | |||
def map(self, values: Any) -> Optional[uuid.UUID]: |
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.
change into value
instead of values
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.
Done
c67655c
to
d92863c
Compare
d92863c
to
9529547
Compare
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.
Please move all sqlalchemy related changes to a separate commit. Also I don't see any tests related to that change.
Support UUID type
9529547
to
ac33c54
Compare
does this work with sqla too? If yes then please add tests. Otherwise looks good to go. i.e. does this fix #331? |
It does not work yet with sqla. And this does not fix #331 which seems to be a sqla issue (I've added comments to this issue to detail what I've found) |
Description
Map Trino UUID type to Python's
Non-technical explanation
Support Trino UUID type
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
(X) Release notes are required, with the following suggested text:
* Maps Trino UUID type into Python's UUID