#32203: Error with values with JSON path lookup in Sqlite when value is numeric.
------------------------------------------+------------------------
Reporter: Gordon Wrigley | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
This Django 3.1.3, I only see this with Sqlite, it works fine with MySQL
and Postgres.
When I do a path lookup with values like
`Bob.objects.values("my_json_field__position")` if there is an integer,
float or bool in "position" then I get a JSON decode error.
Strings, nones, dicts and lists all work, fetching the top level dict
works and filtering on the path lookup works.
`TypeError: the JSON object must be str, bytes or bytearray, not float`
{{{
..\..\.venv\data_browser\lib\site-packages\django\db\models\query.py:287:
in __iter__
self._fetch_all()
..\..\.venv\data_browser\lib\site-packages\django\db\models\query.py:1308:
in _fetch_all
self._result_cache = list(self._iterable_class(self))
..\..\.venv\data_browser\lib\site-packages\django\db\models\query.py:111:
in __iter__
for row in compiler.results_iter(chunked_fetch=self.chunked_fetch,
chunk_size=self.chunk_size):
..\..\.venv\data_browser\lib\site-
packages\django\db\models\sql\compiler.py:1100: in apply_converters
value = converter(value, expression, connection)
..\..\.venv\data_browser\lib\site-
packages\django\db\models\fields\json.py:79: in from_db_value
return json.loads(value, cls=self.decoder)
}}}
Queries that produce strings or None's seem to work fine.
--
Ticket URL: <https://code.djangoproject.com/ticket/32203>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.f8be1f99ef75b6704b86e76fe469ef0f%40djangoproject.com.