Closed cpcloud closed 1 year ago
Running with SQLAlchemy 1.4.46 I get:
In [6]: with engine.begin() as con:
...: print(con.execute(sa.select(sa.func.typeof(sa.literal(uuid.uuid4())))).fetchone())
...:
('uuid',)
when using a uuid.UUID
object.
I suspect this is a result of the new sa.UUID
type that was added in SQLAlchemy 2.0
@cpcloud : Can you provide a PR for this issue? Let me know how I can assist you!
@cpcloud : Can you provide a PR for this issue? Let me know how I can assist you!
No, sorry :) I've got too much on my plate as it is.
_format_prepared_param()
in dbapi.py
does handle the UUID type. The issue is that it receives a string. When looking at the stack trace:
trino/dbapi.py, line 396
trino/dbapi.py, line 387
trino/dbapi.py, line 490
trino/sqlalchemy/dialect.py, line 367
sqlalchemy/engine/base.py, line 1964
sqlalchemy/engine/base.py, line 1842
sqlalchemy/engine/base.py, line 1638
sqlalchemy/sql/elements.p", line 486
sqlalchemy/engine/base.py, line 1414
SQLAlchemy is calling the Python client's do_execute()
method. The problem is that even at this level the parameter is a string. So the issue may be in the SQLAlchemy layer.
Expected behavior
I expected a result of
uuid
Actual behavior
I get a result of
varchar(32)
Steps To Reproduce
Log output
No response
Operating System
NixOS
Trino Python client version
0.321
Trino Server version
406
Python version
3.10.9
Are you willing to submit PR?