Using "iterview" in conjunction with schema objects

86 views
Skip to first unread message

Dave Benson

unread,
Aug 14, 2013, 2:42:04 PM8/14/13
to couch...@googlegroups.com
I have a very large table that I want to iterate and I find that if I just use 

   Widget.view("widget/widgets_by_id", include_docs=True) 

That it downloads the entire database.  Looking at the couchdb-python docs it looks like using 'iterview' instead 'view' would solve my problem.  See: http://pythonhosted.org/CouchDB/client.html#couchdb.client.Database.iterview

But I'm having trouble figuring out how to call that function using the couchdbkit models i've got.  Any ideas?

Benoit Chesneau

unread,
Aug 19, 2013, 6:05:06 PM8/19/13
to couch...@googlegroups.com
Well iterview is probably the same as iter(Widget.view("widget/widgets_by_id", include_docs=True) ) . Next release coming this month will have the view results streaming.

- benoit
 

Alexander Shorin

unread,
Aug 19, 2013, 6:12:50 PM8/19/13
to couch...@googlegroups.com
Not exactly as far as I look at the couchdbkit source code[0]. Correct
me if I'm wrong.

couchdb-python's Database.iterview()[1] method follows Pagination
recipe[2] from CouchDB Guide while iter(Widget.view("widget/
widgets_by_id", include_docs=True)) will iterate over full view
response still having him loaded in memory.


[0]: https://github.com/benoitc/couchdbkit/blob/master/couchdbkit/client.py#L897
[1]: http://code.google.com/p/couchdb-python/source/browse/couchdb/client.py#830
[2]: http://guide.couchdb.org/draft/recipes.html#fast
--
,,,^..^,,,
> --
> You received this message because you are subscribed to the Google Groups
> "couchdbkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to couchdbkit+...@googlegroups.com.
> To post to this group, send email to couch...@googlegroups.com.
> Visit this group at http://groups.google.com/group/couchdbkit.
> For more options, visit https://groups.google.com/groups/opt_out.

Benoit Chesneau

unread,
Aug 19, 2013, 6:15:36 PM8/19/13
to couch...@googlegroups.com

On Aug 20, 2013, at 12:12 AM, Alexander Shorin <kxe...@gmail.com> wrote:

> Not exactly as far as I look at the couchdbkit source code[0]. Correct
> me if I'm wrong.
>
> couchdb-python's Database.iterview()[1] method follows Pagination
> recipe[2] from CouchDB Guide while iter(Widget.view("widget/
> widgets_by_id", include_docs=True)) will iterate over full view
> response still having him loaded in memory.
>
>
> [0]: https://github.com/benoitc/couchdbkit/blob/master/couchdbkit/client.py#L897
> [1]: http://code.google.com/p/couchdb-python/source/browse/couchdb/client.py#830
> [2]: http://guide.couchdb.org/draft/recipes.html#fast
> --
> ,,,^..^,,,
>
>

You're right… View streaming will be quite different since all results will be streamed from the server by line. Something already existing in couchbeam in Erlang.

- benoit
Reply all
Reply to author
Forward
0 new messages