I recently started to consider CouchDB to store a large list of dicts I manipulate in Python. Large in my case means about 20k elements.
I found out that the update()
method is very fast in pushing my whole list in one HTTP call. It takes about 3 seconds, which is perfect for my case.
I also need (in a different script) to retrieve the whole content of this database and store it in a list of dicts. This is the opposite operation to the one above. Unfortunately the only way I found to do this is via
# db is the database opened following a couchdb.Server() call
mylist = list()
for id in db:
mylist.append(db[id])
This takes 10 minutes as there is a call for each element of the loop.
- Is there an equivalent to
update()
to bulk-retrieve the contents of a database? - or should I approach the retrieving part in a different, more efficient way?