A little more code to explain:
Before commit, print u2 doesn't do trigger query.
After commit, print u2 trigger a query, even if it has different
primary key with u1.
So this means : when u update one instance, the other instance of the
same type will be in "expired" state.
##############################
u1 = session.merge(u1)
print "------------------"
print u2
session.commit()
print "------------------"
print us
##############################
On Feb 26, 2:17 pm, 一首诗 <[email protected]> wrote:
> Hi all,
>
> I have 2 user instance in a session and after I have update one of it
> like this
>
> ---------------------------------------------------------------------------
> ------------------------
>
> u = session.merge(u)
> session.commit
> session.refresh(u)
>
> ---------------------------------------------------------------------------
> ------------------------
>
> Later, I found that another instance of the same class type in the
> session's attributes was cleared, and triggered a database query.
>
> (I found this because I am using sqlite, which forbids access the same
> database in more than one thread)
>
> I will make some debug to find out what happened.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---