question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A dictionary inside RedisDict

See original GitHub issue

Hello. Why this doesnt work and how can i get it work?

>>> from pottery import RedisDict
>>> users_dict = RedisDict(redis=redis, key='users_dict')
>>> users_dict
RedisDict{34324144: {'lastname': '', 'notification': 0, 'accesslevel': 1, 'firstname': 'First Name', 'username': 'user'}}
>>> users_dict[34324144]['accesslevel']
1
>>> users_dict[34324144]['accesslevel'] = 4
>>> users_dict[34324144]['accesslevel']
1

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
supernova2033commented, Apr 8, 2016

I am using this workaround at the moment.

tmpdic = users_dict[id]
tmpdic['accesslevel'] = 4
users_dict[id] = tmpdic
1reaction
roskoNcommented, Oct 13, 2018

Hey @brainix

By the way, something I should have written earlier, thank you for your work on pottery!

I am happy to see that you like my suggestion. My use case is a RedisList inside a RedisDict and right now I am using the aforementioned workaround with re-assigning the key each time the child container is changed. So, if this gets implemented, it would let me delete a couple of lines of code.

Cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

redis-dict - PyPI
redis-dict tries to make using Redis as simple as using a dictionary. redis-dict stores data in Redis with key-values, this is according to...
Read more >
How to store and retrieve a dictionary with redis - Stack Overflow
If you want to store a python dict in redis, it is better to store it as json string. import json import redis...
Read more >
Python Nested Dictionary (With Examples) - Programiz
In Python, a nested dictionary is a dictionary inside a dictionary. It's a collection of dictionaries into one single dictionary. nested_dict = {...
Read more >
The two ways of storing nested dictionaries in Redis
The two ways of storing nested dictionaries in Redis. Short about Redis. Redis is an open-source, in-memory data structure store, used as a...
Read more >
Python Nested Dictionary - GeeksforGeeks
A Dictionary in Python works similar to the Dictionary in the real world. Keys of a Dictionary must be unique and of immutable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found