You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Manuel de la Peña <et...@gmail.com> on 2010/01/11 20:17:45 UTC

Bulk update as a single transaction, possible?

Hello *,

I have been working with couchdb (through python) for Ia while and I was
wondering if you could give me a hand with a small problem I'm having. In my
couchdb python application I'd like to be able to perform a bulk operation
in which more than one document is either updated or added to the database.
Currently the python binding does provide a way to perform a bulk update but
this update it is not understood as a single "transaction"
because, although it uses a single request, the changes are
not sequential in the _changes feed and updates and commits are individual,
that is, if there is an error there rest of the documents are not rolled
back. My question is the following:

Does couchdb have such a feature that the python bindings is taking
advantage of?

I do not mind faking the transaction idea from my client code, but I fear
that other applications/parts of the code might work with a document
interval between receiving the result of the bulk update and the rool back
of the operation. Any help would be appreciated.

Kr,

Manuel

Re: Bulk update as a single transaction, possible?

Posted by Markus Jelsma <ma...@buyways.nl>.
Hello Manuel,


Paul is right, a feature like a true multi document transactions with
conflict handling does not exist since the CouchDB 0.9 release and for
good reasons. You can either attempt to circumvent the issue by rethinking
your model as Paul suggests or you can check if your model allows for
CouchDB's new all-or-nothing bulk update operations _without_ conflict
handling.

Please check the wiki on bulk updating [1] for more information on this
topic. But you're probably better of in following Paul's suggestion with
which you bend the mind to fit the couch instead the other way around.

[1] http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API


Regards,




Manuel de la Peña zei:
> Hello *,
>
> I have been working with couchdb (through python) for Ia while and I was
> wondering if you could give me a hand with a small problem I'm having.
> In my couchdb python application I'd like to be able to perform a bulk
> operation in which more than one document is either updated or added to
> the database. Currently the python binding does provide a way to perform
> a bulk update but this update it is not understood as a single
> "transaction"
> because, although it uses a single request, the changes are
> not sequential in the _changes feed and updates and commits are
> individual, that is, if there is an error there rest of the documents
> are not rolled back. My question is the following:
>
> Does couchdb have such a feature that the python bindings is taking
> advantage of?
>
> I do not mind faking the transaction idea from my client code, but I
> fear that other applications/parts of the code might work with a
> document interval between receiving the result of the bulk update and
> the rool back of the operation. Any help would be appreciated.
>
> Kr,
>
> Manuel




Re: Bulk update as a single transaction, possible?

Posted by Paul Davis <pa...@gmail.com>.
2010/1/11 Manuel de la Peña <et...@gmail.com>:
> Hello *,
>
> I have been working with couchdb (through python) for Ia while and I was
> wondering if you could give me a hand with a small problem I'm having. In my
> couchdb python application I'd like to be able to perform a bulk operation
> in which more than one document is either updated or added to the database.
> Currently the python binding does provide a way to perform a bulk update but
> this update it is not understood as a single "transaction"
> because, although it uses a single request, the changes are
> not sequential in the _changes feed and updates and commits are individual,
> that is, if there is an error there rest of the documents are not rolled
> back. My question is the following:
>
> Does couchdb have such a feature that the python bindings is taking
> advantage of?
>
> I do not mind faking the transaction idea from my client code, but I fear
> that other applications/parts of the code might work with a document
> interval between receiving the result of the bulk update and the rool back
> of the operation. Any help would be appreciated.
>
> Kr,
>
> Manuel
>

There is no such feature in CouchDB. Generally speaking there's
probably a way to avoid the necessity to make atomic multi-document
transactions with a bit of rethinking, but that depends on your
specific use case.

HTH,
Paul Davis