This repository was archived by the owner on Apr 19, 2022. It is now read-only.
Make default property value functionality the same as in the original datastore NDB. #11
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.

The original NDB behavior when using default parameter is passing the default value inside datastore even when initiating a Model without the relevant. Currently, that doesn't happen. The entity is being saved without the default value which means that you can't query on it and worst than that, if you'll change the default value in the application level it'll affect on retro actively inserted queries.
Python 2.7 NDB example code:
In python 2.7 this entity will be saved with myCounter=20 in datastore while in python 3.7 this entity will be saved as an empty (containing only a key, missing myCounter aka missing all default properties that wasn't set explicitly in the Model init).
Python 37 NDB example code:
Can be checked easily with this code:
client.get(client.key('DefaultTest', 123))['myCounter']Which will get an exception in the Python 3.7 DS while in the 2.7 DS it'll get the correct value.