Getting

11 views
Skip to first unread message

David Montgomery

unread,
Feb 11, 2012, 12:37:50 PM2/11/12
to redi...@googlegroups.com
When I use redis-cli this command works:

hmget cr00000000img:meta url
1) "http://www.test.com"


In python:

redirect = r.hmget("cr00000000img:meta", "url")
print redirect
[None, None, None]

So....where did I err? I would think the result would be [
"http://www.test.com"]

There is one more key in he hash but I only need url.


Thanks

Andy McCurdy

unread,
Feb 11, 2012, 12:43:33 PM2/11/12
to redi...@googlegroups.com
r.hmget("cr00000000img:meta", ["url"])


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Salvatore Sanfilippo

unread,
Feb 11, 2012, 12:45:49 PM2/11/12
to redi...@googlegroups.com
On Sat, Feb 11, 2012 at 6:43 PM, Andy McCurdy <sed...@gmail.com> wrote:

> r.hmget("cr00000000img:meta", ["url"])

Hi Andy, this is about API, and API is about taste, but can I ask you
why Python lib does not check the type of the arguments and do the
right thing? This way you could do both:

r.hmget(key,"myfield1","myfield2") and it should work well, but also:

r.hmget(key,fields_array);

I my opinion this is an interface creating less troubles to newcomers.

Cheers,
Salvatore

--
Salvatore 'antirez' Sanfilippo
open source developer - VMware

http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele

Andy McCurdy

unread,
Feb 11, 2012, 12:52:47 PM2/11/12
to redi...@googlegroups.com
It was an oversight with hmset. Other methods already allow for this.
I'll fix it when I'm in front of a computer.

Dvir Volk

unread,
Feb 12, 2012, 5:10:52 AM2/12/12
to redi...@googlegroups.com
Hi Andy, 
Adding to this, I think some unification of the variadic API calls is in order. either go with lists and dicts, or with *args and **kwargs across the board.
for example,
zadd() accepts **kwargs
hmset() accepts a dict

hmget() accepts a list
sadd() accepts *args

Just my 2 cents.
Dvir
--
Dvir Volk
System Architect, The Everything Project (formerly DoAT)

Salvatore Sanfilippo

unread,
Feb 12, 2012, 5:13:24 AM2/12/12
to redi...@googlegroups.com
On Sat, Feb 11, 2012 at 6:52 PM, Andy McCurdy <sed...@gmail.com> wrote:

> It was an oversight with hmset. Other methods already allow for this.
> I'll fix it when I'm in front of a computer.

Thanks for the clarification, I was just interested to understand if
it was a design issue due to some Python feature/pattern I didn't know
or just a matter of implementing it.

Cheers,
Salvatore

Reply all
Reply to author
Forward
0 new messages