Repository navigation
fix(django-google-spanner): support JSONField read and write operations - #19007
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for Django's JSONField in the Google Cloud Spanner backend by adding utility functions to adapt and convert JSON values, along with corresponding unit and mock server tests. Feedback is provided to optimize the recursive _unwrap_json_object serialization helper by checking for standard Python types first, which avoids expensive isinstance checks on standard elements in performance-critical paths.
olavloite
reviewed
Nov 7, 2026
olavloite
approved these changes
Nov 12, 2026
olavloite
left a comment
Contributor
There was a problem hiding this comment.
LGTM, but we should update the PR description, as it does not fit the actual implementation anymore.
sakthivelmanii
force-pushed
the
fix_json_field_spanner
branch
from
November 12, 2026 18:58
16ef6a6 to
6e46f21
Compare
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.
Reading and writing Django
JSONFieldvalues previously failed on Cloud Spanner because JSON values were not adapted to Spanner's nativeJSONparameter type on writes, and parsed JSON objects returned by the Spanner driver were passed back into Django's string-based JSON deserializer on reads.This change enables full
JSONFieldsupport in the Cloud Spanner Django backend, including against the Cloud Spanner Emulator:NULL(when assigningNoneto a nullable field) and JSONnull(when usingValue(None, JSONField())).has_key,has_keys, andhas_any_keys).