Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nodata example to collections #129

Merged
merged 3 commits into from
Aug 19, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scrapinghub/client/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,17 @@ class Collection(object):
>>> foo_store.iter()
<generator object jldecode at 0x1049eef10>

- iterate iterate over _key & value pair::
- iterate over _key & value pair::

>>> for elem in foo_store.iter(count=1)):
... print(elem)
[{'_key': '002d050ee3ff6192dcbecc4e4b4457d7', 'value': '1447221694537'}]

- get 1000th item key::

>>> keys = foo_store.list(nodata=True, meta=["_key"]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, wouldn’t it be slightly better to use .iter() with https://docs.python.org/3/library/itertools.html#itertools.islice, to avoid building a big list?

>>> keys[1000]
{'_key': '002d050ee3ff6192dcbecc4e4b4457d7'}

- filter by multiple keys, only values for keys that exist will be returned::

Expand Down