Re: Retrieve keys on bucket by timestamp
Hi tele, Yes, a secondary index is the most reasonable way to accomplish this. Here's an example using the Python client: now = time.gmtime() myobj.add_index('modified_int', now) myobj.store() bucket.get_index('modified_int', now-3600, now+3600) Hope that helps. On Wed, Sep 3, 2014 at 9:09 PM, tele t...@rhizomatica.org wrote: Hi All, Is there any way i can retrieve from a bucket the keys that last change N minutes ago for example. If possible cis there a way to do it with riak-python-client? Or the only way is to add a timestamp index in the bucket and update in case of changes, so that i will be able to query that index. Thanks :tele ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com -- Sean Cribbs s...@basho.com Software Engineer Basho Technologies, Inc. http://basho.com/ ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Retrieve keys on bucket by timestamp
This is really useful! So we can use now as a constant to get a current timestamp? Thanks! Alex On Thu, Sep 4, 2014 at 3:44 PM, Sean Cribbs s...@basho.com wrote: Hi tele, Yes, a secondary index is the most reasonable way to accomplish this. Here's an example using the Python client: now = time.gmtime() myobj.add_index('modified_int', now) myobj.store() bucket.get_index('modified_int', now-3600, now+3600) Hope that helps. On Wed, Sep 3, 2014 at 9:09 PM, tele t...@rhizomatica.org wrote: Hi All, Is there any way i can retrieve from a bucket the keys that last change N minutes ago for example. If possible cis there a way to do it with riak-python-client? Or the only way is to add a timestamp index in the bucket and update in case of changes, so that i will be able to query that index. Thanks :tele ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com -- Sean Cribbs s...@basho.com Software Engineer Basho Technologies, Inc. http://basho.com/ ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Retrieve keys on bucket by timestamp
damn... i got excited i missed the first line now = time.gmtime()... forget my stupid question... lol Thanks, Alex On Thu, Sep 4, 2014 at 4:10 PM, Alex De la rosa alex.rosa@gmail.com wrote: This is really useful! So we can use now as a constant to get a current timestamp? Thanks! Alex On Thu, Sep 4, 2014 at 3:44 PM, Sean Cribbs s...@basho.com wrote: Hi tele, Yes, a secondary index is the most reasonable way to accomplish this. Here's an example using the Python client: now = time.gmtime() myobj.add_index('modified_int', now) myobj.store() bucket.get_index('modified_int', now-3600, now+3600) Hope that helps. On Wed, Sep 3, 2014 at 9:09 PM, tele t...@rhizomatica.org wrote: Hi All, Is there any way i can retrieve from a bucket the keys that last change N minutes ago for example. If possible cis there a way to do it with riak-python-client? Or the only way is to add a timestamp index in the bucket and update in case of changes, so that i will be able to query that index. Thanks :tele ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com -- Sean Cribbs s...@basho.com Software Engineer Basho Technologies, Inc. http://basho.com/ ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Retrieve keys on bucket by timestamp
Hi Sean, Received. thanks! :tele On Thu, 4 Sep 2014 08:44:14 -0500 Sean Cribbs s...@basho.com wrote: Hi tele, Yes, a secondary index is the most reasonable way to accomplish this. Here's an example using the Python client: now = time.gmtime() myobj.add_index('modified_int', now) myobj.store() bucket.get_index('modified_int', now-3600, now+3600) Hope that helps. On Wed, Sep 3, 2014 at 9:09 PM, tele t...@rhizomatica.org wrote: Hi All, Is there any way i can retrieve from a bucket the keys that last change N minutes ago for example. If possible cis there a way to do it with riak-python-client? Or the only way is to add a timestamp index in the bucket and update in case of changes, so that i will be able to query that index. Thanks :tele ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Retrieve keys on bucket by timestamp
Hi All, Is there any way i can retrieve from a bucket the keys that last change N minutes ago for example. If possible cis there a way to do it with riak-python-client? Or the only way is to add a timestamp index in the bucket and update in case of changes, so that i will be able to query that index. Thanks :tele ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com