Values construct does not work with UUIDs #6268
Replies: 2 comments 1 reply
-
Hi, The output is like that since it's executing what you have specified in
SQLAlchemy is delegating the conversion to literal values to your implementation, to it has no way of knowing how to change what is returned. If you remove |
Beta Was this translation helpful? Give feedback.
-
using the following to add quotes around the value for instance:
then breaks the insert:
So this is why I suspected the issue could have been with I ended having to do a code like that to specifically catch the case when I have a UUID:
and manually cast to UUID from a string, otherwise PostgreSQL would complain on mismatch between varchar and UUID. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When joining with
values()
construct withUUID
(using the implementation provided in the docs), the actual values are not surrounded by single quotes when sent to PostgreSQL and when usingliteral_binds=True
. We are usingliteral_binds
becuase we also have MSSQL server that use the same code and parameters count is limited to 2,100 by default on MSSQL.Expected behavior
values()
should cast or surround the 'UUIDs' with stringsTo Reproduce
Error
Versions.
Additional context
interestingly, the query object seems to have the single quotes around it. The query may not work since there is no cast to a UUID, but at least the string is quoted - see attached screen
Thanks
![Snag_5a65a1d](https://user-images.githubusercontent.com/889679/114759506-dea98580-9d23-11eb-88ff-c46b1134e027.png)
Beta Was this translation helpful? Give feedback.
All reactions