By the way, must get() always accept a primary key? For composite keys is there a shortcut to access its "ident" (in the correct order)? (So I could get the ident tuple and pass it to get() with populate_existing()....)

On Mar 19, 2010, at 1:12 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:


On Mar 19, 2010, at 12:34 PM, Kent wrote:

With query() I can add with_lockmode('for update'). Can I do so on a
session.refresh()? What about a get()?

a get() yes. a refresh() no, but that's a fine idea so I've committed a flag for that in rab5a31b4f3bf. A substitute is query.populate_existing().with_lockmode('for_update').get(object.id).



I see this as a useful approach to a two phase large query, where one
wants to avoid locking a large number of rows.  First you would issue
a non-locking query and then, once you have a candidate object you
could call refresh with a lock, so you know you have the most recent
data and that it is locked.

--
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 .


--
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