sripathikrishnan / redis-rdb-tools

Parse Redis dump.rdb files, Analyze Memory, and Export Data to JSON
https://rdbtools.com
MIT License
5.07k stars 739 forks source link

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

Open hq519Simplifi opened 5 years ago

oranagra commented 5 years ago

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.

hq519Simplifi commented 5 years ago

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

oranagra commented 5 years ago

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.

hq519Simplifi commented 5 years ago

Thanks