avdd wrote:
> So I get around this by essentially doing:
>
> # called on every request
> def refresh_model(context, obj):
>     context.get_db().add(obj)
>
> def store_model(context, obj):
>     db = object_session(obj)
>     if db:
>         db.expunge(obj)
>     obj = db.merge(obj)
>     db.flush()
>     return obj
>
> Which seems to be working well so far.
>
>
> Mike, I understand you are busy and all, but I was hoping to learn
> what you thought of the usage I mentioned:
>
> 1. create or load object, don't flush, and detach
> 2. reattach object, modify, don't flush and detach
> 3. repeat 2 as necessary
> 4. when ready, reattach object and commit

the behavior you first illustrated, that of merge() and add() not acting
the same regarding pending changes, was a behavior that was somewhat in
the realm of a bug.   I mentioned the other day it was fixed in r6711.  
The save-update cascade should place all the objects as well as those
which have been removed from collections in the new session.


>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to