On Apr 14, 2011, at 9:36 AM, bool wrote:

> 
> Thanks Michael Trier.
> 
> 
> Michael Bayer,
> 
>    Can you help me with the other two questions I asked ?

yes but I would note that lots of people on this list are capable of answering 
these questions.   Am trying to slow my responses so that others can more 
easily participate.

> Why does mapper cache for update/insert/delete

This is to improve performance.    update/delete statements emitted during the 
flush are strictly against primary key identity and possibly a version id 
column and there's no use case for modifying the WHERE criterion ad hoc within 
a flush.   An update that uses a WHERE against fluid criterion is more 
appropriate in the query.update() use case, where the previous recipe I gave 
would still work.

> and can you confirm it
> does not do this for select and I can safely use this approach for
> select with ORM?

selects aren't cached.   The only caching with query comes into play when you 
use get() - it will fetch the given identity from the identity map if present.

> Is there a recipe/code which I can quickly refer to get started on
> before_insert and also how to modify a insert statement in
> before_insert?

there's a short example of before_insert right here:  
http://www.sqlalchemy.org/docs/orm/interfaces.html#mapper-events


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

Reply via email to