On Dec 19, 2009, at 4:06 AM, Yusuf Mohsinally wrote:

> In your experience, would it be better to use the
> "@transaction.commit_on_success" decorator for the functions that need
> it, or turn on transaction middleware for the whole app?

My general approach, when using PostgreSQL as the backend, is to turn  
on Autocommit, and then use either the commit_on_success decorator or  
manual transaction calls for those functions that update the database.

The ideal situation is to have functions that just query the database  
run outside of an explicit transaction, wrapping those update  
operations that require it in their own transactions.

The downside of that is that using Autocommit affects the entire  
project, so other applications that you didn't write may be surprised  
when the default Django behavior of opening a transaction for each  
view method is defeated.
--
-- Christophe Pettus
    [email protected]

--

You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en.


Reply via email to