Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#29821 closed New feature (duplicate)

Add JSONField for all supported DBs (and move into core).

Reported by: Vackar Afzal Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: Oracle Json
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django has added JSONField for postgres databases.
Given that Oracle 12 now has native JSON columns, would be nice to expose this in a similar fashion.

I've provided a reference implementation [here https://github.com/Exscientia/oracle-json-field] and made it available via [pip https://pypi.org/project/oracle-json-field/]. It is based heavily on the Postgres implementation.

Note: In the reference implementation I have added a .filter_json() method whose only purpose is to ensure that table names are aliased - an Oracle requirement for Json queries. If there is a cleaner way to force table names to be aliased then this can be removed, and give 100% feature parity with Django's core query API i.e. just use MyModel.objects.filter(...)

Is this something that you would consider adding to the official Django project. If so please feel free to re-use any of the code from the reference implementation. Additionally I would be happy to create a pull-request if it makes integration easier.

Change History (4)

comment:1 by Carlton Gibson, 6 years ago

Summary: Oracle Native JSON FieldAdd JSONField for all supported DBs (and move into core).
Version: 2.0master

Hi Vackar.

If you don't mind, I'm going to retitle this from "Oracle Native JSON Field".

Adding a JSONField for all DBs has been discussed on the mailing list a couple of times:

The main take-home there was:

  • "Yes +1"
  • May need to go through a formal DEP process to pin down details.
  • Can't just be serialising to a text blob under-the-hood.
  • Could be moved from contrib into core.

This last is now viable on all supported DBs (I believe).

You've provided an example for Oracle. The Django django-mysql package does similar there.
(Is there an SQLite option yet?)

I think a candidate for inclusion in Django itself would need to handle all supported databases, rather than just the one.

Version 0, edited 6 years ago by Carlton Gibson (next)

comment:2 by Carlton Gibson, 6 years ago

Triage Stage: UnreviewedAccepted

(I think this is legitimate, even if a DEP is needed before implementation. Thus Accepting. Please adjust if that's the wrong flow.)

comment:3 by Tim Graham, 6 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #12990 which I reopened.

comment:4 by Vackar Afzal, 6 years ago

Thanks for the swift resolution on this, great to see that this may become part of the core.

Note: See TracTickets for help on using tickets.
Back to Top