SCAN command in Python

1,298 views
Skip to first unread message

Marco Ippolito

unread,
Jan 22, 2014, 1:55:10 PM1/22/14
to redi...@googlegroups.com
Hi everybody,

I have redis 2.8.4.
I'm following the indications here : http://redis.io/commands/scan about SCAN command.
and within redis-cli environment works fine but I didn't manage to make SCAN command work in python.

Would you please be so kind in giving a me a quick short example?
(I searched around but I didn't find any references)

Thank you very much.
Kind regards.
Marco

Josiah Carlson

unread,
Jan 22, 2014, 2:08:36 PM1/22/14
to redi...@googlegroups.com
The simple API command wasn't implemented in some versions of the Python Redis 2.8 client (I don't know if it is now), but you can still execute it:

first = True
cursor = '0'
while cursor != '0' or first:
    cursor, data = c.execute_command('scan', cursor)
    first = False
    # do something with data

 - Josiah



--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.

Marco Ippolito

unread,
Jan 22, 2014, 2:23:08 PM1/22/14
to redi...@googlegroups.com
Hi Josiah,

thank you very much for your kind answer and help.

Kind regards.
Marco

Andy McCurdy

unread,
Jan 22, 2014, 2:47:14 PM1/22/14
to redi...@googlegroups.com
SCAN and its related commands are available is redis-py 2.9.0. 

Marco Ippolito

unread,
Jan 22, 2014, 3:02:27 PM1/22/14
to redi...@googlegroups.com
Hi Andy,

I searched 'scan' in http://redis-py.readthedocs.org/en/latest/index.html but I didn't find anything

Marco

Gilles Reyna

unread,
Feb 3, 2014, 4:47:48 PM2/3/14
to redi...@googlegroups.com
Hi Marco,

 You'll find the function in the client.py file under the redis-py dir
 Trying sscan right now ! ;)

KR,

gilles
Reply all
Reply to author
Forward
0 new messages