> > > You shouldn't do that. To correctly handle transactions in distributed > databases, you should use prepared transactions/two phase commit, which > Sequel supports on some databases. See > http://sequel.jeremyevans.net/rdoc/files/doc/transactions_rdoc.html > >
One database is redshift the other is postgres so I'll try this and see what happens. > If you can't use prepared transactions, you can use Sequel.transaction: > > Sequel.transaction([db1, db2]) do > r1 = db1[sql].returning.all > r2 = db2[sql].returning.all > raise Sequel::Rollback unless (do some checking here) > end > > Note that Sequel.transaction uses regular transactions, so if the first > database commits and the second database fails to commit (due to deferred > constraint violations, for example), you have some serious problems. > > This would mess me up for sure. It has to be all or nothing on both databases. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
