Created
November 15, 2022 20:09
-
-
Save nvllsvm/457b8801bcfd703cb4f3bce1d01b0ab4 to your computer and use it in GitHub Desktop.
sqlitedict + zstandard compression (w/ immediatey disk writes)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlitedict | |
import zstandard | |
def zstd_sqlitedict(*args, **kwargs): | |
return sqlitedict.SqliteDict( | |
*args, | |
decode=lambda obj: sqlitedict.decode(zstandard.decompress(obj)), | |
encode=lambda obj: zstandard.compress(bytes(sqlitedict.encode(obj))), | |
autocommit=True, | |
**kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment