views:

55

answers:

1

Hello,

I wonder what you can use as a key_name? I do a lot of queries on non-ascii unicode characters, I wonder if I can use these as key names to speed up the queries.

Thanks!

+4  A: 

Per the documentation, key_name is a unicode string, though plain str values get converted as ASCII -- so you'll want to make sure you're actually providing a true unicode string (I strongly suggest reading the entire Python Unicode HOWTO).

Nicholas Knight
I can use non latin characters, but I have problems using get_by_key_name() to get long keys (several characters)
@user: Not sure why that would be. Key length limits are something like 500 bytes, and even worst-case UTF-8 encoded strings could fit dozens of characters in there. Do you have an extremely long path, perchance?
Nicholas Knight
No long path.I think it is an encoding problem.I don't know where though, I made sure to use unicode strings.It seems I can create keys, but I can get them only if they are 1 character long.