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 two tables that have a many to one relationship, such as the one described above. Any given user can only have a single car that is_main_car. Additionally, the first car a user gets must be the main car.
I am trying to determine how the transactional semantics work with this relationship within a Session. If I read the user, and then use the user.cars field to determine if the user has 0 cars or already has a main car, can I rely on that condition still being true when I write my new main Car row to the Cars table (assuming it is all within a single Session)?
This discussion was converted from issue #176 on August 12, 2025 19:14.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I have two tables that have a many to one relationship, such as the one described above. Any given user can only have a single car that
is_main_car
. Additionally, the first car a user gets must be the main car.I am trying to determine how the transactional semantics work with this relationship within a Session. If I read the
user
, and then use theuser.cars
field to determine if the user has 0 cars or already has a main car, can I rely on that condition still being true when I write my new mainCar
row to theCars
table (assuming it is all within a single Session)?Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.9.7
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions