#32135: JSONField db_type `jsonb`==>`json` for sequential data no longer works
-------------------------------------+-------------------------------------
Reporter: Michael Anuzis | Owner: nobody
Type: Uncategorized | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by sage):
I'd like to note, if you still want to use JSON, you can register a
handler for the [https://docs.djangoproject.com/en/3.1/ref/signals
/#connection-created connection_created] signal. The handler should
register a stub loader for JSON by calling
`psycopg2.extras.register_default_json(conn_or_curs=connection,
loads=lambda x: x)`. See
[https://github.com/django/django/blob/master/django/db/backends/postgresql/base.py#L203-L206
the registration for JSONB here]. Otherwise, then you would have to
override `from_db_value` so it just returns the value because it's already
handled by psycopg2.
--
Ticket URL: <https://code.djangoproject.com/ticket/32135#comment:5>
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/064.52d264c7674272398d164f619dc9a6d6%40djangoproject.com.