I need to get all the databases stored in redis server using python-redis Thanks
Look here List All Redis Databases
Then in python you can do:
In [3]: r = redis.StrictRedis()
In [4]: r.config_get('databases')
Out[4]: {'databases': '16'}
In [5]: r.info('keyspace')
Out[5]: {'db0': {'avg_ttl': 0, 'expires': 0, 'keys': 4}}
i've tried this
import redis
ser = redis.Redis()
print ser.config_get('databases')
and the console return this
{}
and if i put this
import redis
ser = redis.StrictRedis()
print ser.config_get('databases')
it return this
ser = redis.StrictRedis()
AttributeError: 'module' object has no attribute 'StrictRedis'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With