adding optional (not enabled by default) ability to encode keys - #161
Merged
Conversation
mpenkov
reviewed
Oct 22, 2022
Comment on lines
+102
to
+103
| autocommit=False, journal_mode="DELETE", encode=encode, | ||
| decode=decode, timeout=5, outer_stack=True): | ||
| #decode=decode, encode_key=identity, decode_key=identity, |
Collaborator
There was a problem hiding this comment.
What is this commented line?
Contributor
Author
There was a problem hiding this comment.
Ups, a mistake. I just pushed a fix.
Collaborator
|
Can you please fix the flake8 errors in the code as well? https://github.com/RaRe-Technologies/sqlitedict/actions/runs/3303841568/jobs/5456104420 |
Contributor
Author
|
I just fixed the flake8 errors. Would documenting this optional key encoding in the README be a good idea? I added a commit for that. |
Contributor
Author
|
Could we merge this into master? This PR adds attempts to add a useful optional feature, while introducing minimum extra complexity and not affecting performance. |
Collaborator
|
Yes, of course. I've merged your work. Thank you! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull requests adds the optional behavior of encoding keys.
The justification: support for hashable, but not
str(orint) keys, e.g.tupleas a key.The changes include:
encode_keyanddecode_keymethodencode_keyanddecode_keywhich are base64 encoding of pickle dump of keyPotential problems: