Relationship load options affect following queries #11040
Replies: 2 comments 9 replies
-
|
Hi, The session will deduplicate the incoming objects with the ones that are already in the session, so the you get on the second query is the same b you obtained from the fist query, meaning that this assertion should pass You can use populate existing to update the data in the session (not sure if it works in this case, but it should) https://docs.sqlalchemy.org/en/20/orm/queryguide/api.html#populate-existing |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the quick reply! Indeed, Is there an alternative pattern we should be using for this type of data load? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
Optional link from https://docs.sqlalchemy.org which documents the behavior that is expected
https://docs.sqlalchemy.org/en/14/orm/loading_relationships.html
SQLAlchemy Version in Use
1.4.50
DBAPI (i.e. the database driver)
pysqlite, psycopg2
Database Vendor and Major Version
SQLite, PostgreSQL
Python Version
3.11.6
Operating system
WSL
To Reproduce
Error
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions