Issue with JsonField in ORM Causing Data Retrieval Failure #905
Labels
api: spanner
Issues related to the googleapis/python-spanner-django API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
I am encountering an issue when using JsonField in a Django model with Google Spanner. After saving data into a table that contains a JsonField through the Django ORM, I am unable to retrieve the data due to a TypeError.
The error occurs when attempting to query the table, and the following traceback is returned:
It seems like the JsonField data type is not being handled correctly when reading from the database, possibly related to how the data is being serialized and deserialized.
Steps to reproduce:
Create a model with a JsonField.
Save data using the Django ORM.
Attempt to query the table containing the JsonField.
Expected behavior: The data should be retrieved and deserialized correctly.
Actual behavior: The query fails with a TypeError, indicating that the JSON object must be str, bytes, or bytearray, but JsonObject is being returned.
Any help on resolving this issue would be greatly appreciated!
The text was updated successfully, but these errors were encountered: