On Jul 6, 2013, at 2:54 PM, Leandro Boscariol wrote:

> How can I do a transaction management in both databases at the same time? Is 
> that even possible?

You can certainly nest the transaction context managers (atomic() in 1.6+, or 
you can use xact() in 1.5 and earlier):

   with xact(using=DATABASE1):
      with xact(using=DATABASE2):
         things

If an exception occurs, it will rollback both; if it exits normally, it will 
commit both.  Note that this isn't true two-phase commit; it's perfectly 
possible for the inner transaction to successfully commit but the outer one to 
fail.  If you want proper two-phase commit, you'll (at the moment, at least) 
have to roll your own.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to