Closed farhankhwaja closed 7 years ago
Iterating over the database object myDB
accomplishes two things:
myDB
cache. Remember that myDB
is at its core a dict
with some fancy functionality added in. (probably not desired for your case??)While obviously retrieving your documents is the desired behavior here, I think that caching those documents locally is what is causing your eventual MemoryError
.
My suggestion to you is to iterate over a Result
object instead. Doing this provides you with similar behavior to bullet 1 with none of the side effects of bullet 2. There are two ways you can do this:
Via the database custom_result
context manager, for example:
with myDB.custom_result(include_docs=True) as results:
for result in results:
...
Via a Result
object directly, for example:
results = Result(myDB.all_docs, include_docs=True)
for result in results:
...
These two approaches essentially do the same thing. Have a look at the custom_result and the Result to compare if you are interested in the specifics.
I hope that resolves your memory issue.
Please include the following information in your ticket.
I was trying to download all the documents from my DB which has 1.3 Mil documents. I awas able to download 610,000 documents.
ERROR
Can anyone help me with this.