There is a single function. In your case you would call

    dba.distributed_transaction_commit(dba,dbb)

or

try:
    dba.distributed_transaction_commit(dba,dbb)
except:
    session.flash="distributed transaction failed and rolled back"

I have not tried this in some time but when I tried worked fine.
postgresql only.


On Oct 29, 4:39 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Massimo,
>
> Would you mind giving a more in depth example on distributed transactions
> with postgres? I know web2py supports them, however there is not much
> information on it. How would you accomplish a join across databases?
>
> Is there an api to abstract this?
>
> dba = DAL('postgres...')
> dbb = DAL('postgrse...')
>
> dba.define_table('customers'....)
> dba.define_table('employees'....)
> dbb.define_table('products'....)
> dbb.define_table('sales'.....)
>
> db = DISTRIBUTED_DAL(dba, dbb)
>
> rows = db(db.customers.id == request.vars.cust_id)(db.sales.id ==
> request.vars.sale_id).select()
>
> for row in rows:
>    print row.customer.name, row.customer.address, row.sale.time,
> row.sale.product.name
>
> -Thadeus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to