laughingman7743 / PyAthena

PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
MIT License
463 stars 105 forks source link

`UUID` in a query gets garbled #492

Closed sevanteri closed 1 year ago

sevanteri commented 1 year ago

Just upgraded from 3.0.8 to 3.0.10 and it seems handling UUIDs broke.

[ins] In [1]: from pyathena.sqlalchemy.base import AthenaDialect

[ins] In [2]: import sqlalchemy as SQA

[ins] In [3]: import uuid

[ins] In [4]: query = SQA.select(SQA.literal(uuid.UUID(int=0)))

[ins] In [5]: str(query.compile(dialect=AthenaDialect(), compile_kwargs={"literal_binds": True}))
Out[5]: "SELECT '00000000000000000000000000000000' AS anon_1"
laughingman7743 commented 1 year ago

https://github.com/laughingman7743/PyAthena/compare/v3.0.8...v3.0.10 Is there any change that might be related to this? 🤔 It may be a different version of SQLAlchemy. I need more information to investigate.

sevanteri commented 1 year ago

Hmmh... could also be SQLAlchemy. Just checked and we also upgraded that.

Seems like at least mysql and sqlite dialects do the same thing. Postgresql dialect doesn't.

sevanteri commented 1 year ago

Okay this is clearly not an issue in pyAthena but somewhere in SQLAlchemy, or my brain. I'll just close this, at least for now.