You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a UUID field as my primary key, and am inserting items as seen in the code above. Whenever I add two items to my session and commit, it leads to the following error:
InvalidRequestError: Can't match sentinel values in result set to parameter sets; key '34bdaa33-90fe-4058-a278-3561fe04ad70' was not found. There may be a mismatch between the datatype passed to the DBAPI driver vs. that which it returns in a result row. Ensure the given Python value matches the expected result type *exactly*, taking care to not rely upon implicit conversions which may occur such as when using strings in place of UUID or integer values, etc.
The columns created_at and updated_at seem to cause the error -- without these columns it works as expected.
I've created a SQLAlchemy issue here, which reproduces the error without using SQLModel, but it turns out this is expected behavior.
The GUID class could be updated as described here to include _sentinel_value_resolver, or can be swapped out for the Uuid type as recommended here and here.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
I have a UUID field as my primary key, and am inserting items as seen in the code above. Whenever I add two items to my session and commit, it leads to the following error:
InvalidRequestError: Can't match sentinel values in result set to parameter sets; key '34bdaa33-90fe-4058-a278-3561fe04ad70' was not found. There may be a mismatch between the datatype passed to the DBAPI driver vs. that which it returns in a result row. Ensure the given Python value matches the expected result type *exactly*, taking care to not rely upon implicit conversions which may occur such as when using strings in place of UUID or integer values, etc.
created_at
andupdated_at
seem to cause the error -- without these columns it works as expected._sentinel_value_resolver
, or can be swapped out for theUuid
type as recommended here and here.Operating System
macOS
Operating System Details
sqlalchemy==2.0.28
SQLModel Version
0.0.16
Python Version
3.11
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions