redis-rdb-tools icon indicating copy to clipboard operation
redis-rdb-tools copied to clipboard

Question -- If the data is snappy compressed, is it possible to decompress when parse it with rdb-tools ?

Open hq519Simplifi opened this issue 7 years ago • 4 comments

hq519Simplifi avatar Dec 05 '18 20:12 hq519Simplifi

Hi, your question is very unclear, there's no snappy compression in redis, and i'm not sure what you want to achieve. i can only assume that you mean that the rdb file was compressed, and you want to parse it directly from the compressed form. you can do that by using the python functions (not the CLI), there's a parse_fd function that takes a file object, you can pass it a file like object that wraps a file object and does the decompression. if that's not what you mean, please provide more info.

oranagra avatar Dec 05 '18 20:12 oranagra

Thanks for info. The data object stored in the redis db is snappy compressed , when it saved as redis backup files, is there way can use python to extract and decompress the data object if directly read the rdb files? For redis db, I can use: r = redis.Redis( ...) keys = r.randomkey() y = r.get(keys) y2 = snappy.uncompress(y) return y2

hq519Simplifi avatar Dec 05 '18 21:12 hq519Simplifi

ohh. maybe implement a new callback class, that derives from the json callback class. then on each callback, do your decompression, and forward the decompressed data to the json class method.

oranagra avatar Dec 05 '18 21:12 oranagra

Thanks

hq519Simplifi avatar Dec 10 '18 19:12 hq519Simplifi