#Getting an entire table's keys and values

9 messages · Page 1 of 1 (latest)

novel torrent
#

What table?

novel torrent
#

what db? Is that sql-based, mongo, redis? Table usually related to the sql DBMS...

#

So, redis doesn't have any tables

#

It's key-value db. To get all keys from the db with values - use the SCAN * and iterate over all keys.

#

Scan one by one. Just replace delete with your code to get value from those keys.

#
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
for key in r.scan_iter("*"):
    print(key, r.get(key))

smth like that.. If you need it as json - go ahead and make a json object and fill it in the loop