[Django] #27694: Improve documentation of supported lookups on HStore & JSON fields

9 views
Skip to first unread message

Django

unread,
Jan 5, 2017, 1:02:38 PM1/5/17
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-----------------------------------------+------------------------
Reporter: melinath | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
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 |
-----------------------------------------+------------------------
[https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/ The
documentation of supported lookups on HStore & JSON fields is lacking.]
For example, HStoreField supports `iexact` lookups, but the documentation
has a scary warning implying that this is not the case:

Since any string could be a key in a hstore value, any lookup other
than those listed below will be interpreted as a key lookup.

iexact is not listed below – but neither is contains, which is used
directly ''above'' the scary warning as an example of how "You can chain
other lookups after key lookups". (Actually, contains ''is'' listed below,
but it's a different contains that applies only to the field level and not
to a specific key.)

I suspect that the intended meaning is that ''all'' lookups are supported
after a key lookup, and that the ''first'' lookup on the hstore field must
be a key or one of the special lookups listed below.

JSONField does not mention being able to chain lookups after key lookups
at all - but I can see people using gt and in
[http://www.lexev.org/en/2015/trying-json-combo-django-and-postgresql/ in
blog posts like this]. BUT iexact lookups
[https://code.djangoproject.com/ticket/27693 don't currently work] on
JSONField.

--
Ticket URL: <https://code.djangoproject.com/ticket/27694>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 9, 2017, 6:59:58 AM1/9/17
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:1>

Django

unread,
Mar 24, 2020, 4:35:20 AM3/24/20
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by felixxm):

`JSONField`-part of this ticket is fixed as a part of
[https://github.com/django/django/pull/12392 PR].

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:2>

Django

unread,
May 8, 2020, 1:51:59 AM5/8/20
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd" 6789ded0]:
{{{
#!CommitTicketReference repository=""
revision="6789ded0a6ab797f0dcdfa6ad5d1cfa46e23abcd"
Fixed #12990, Refs #27694 -- Added JSONField model field.

Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.

Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.

Co-authored-by: Mariusz Felisiak <felisiak...@gmail.com>
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:3>

Django

unread,
Apr 21, 2021, 6:04:38 AM4/21/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:4>

Django

unread,
May 29, 2021, 12:08:20 AM5/29/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: cammil
Type: Cleanup/optimization | Status: assigned

Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* owner: nobody => cammil
* status: new => assigned
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/14367 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:5>

Django

unread,
May 29, 2021, 6:39:44 AM5/29/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: (none)
Type: Cleanup/optimization | Status: new

Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: cammil => (none)
* status: assigned => new
* has_patch: 1 => 0


Comment:

Jacob, this patch has nothing to do with the `HStore` docs.

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:6>

Django

unread,
May 29, 2021, 6:49:37 AM5/29/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by cammil):

Yeh. Not sure what that PR has to do with this ticket. Seems completely
unrelated to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:7>

Django

unread,
May 29, 2021, 10:12:15 AM5/29/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Jacob Walls):

Thanks, I've asked the author of the unrelated patch to update the ticket
number he referenced. Sorry for the noise (and for not reading the patch
before linking here).

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:8>

Django

unread,
Sep 30, 2021, 9:39:24 PM9/30/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Sarah Abderemane):

I'd be happy to help on this issue but HStore is new for me, {{{iexact}}}
on HStoreField lookup, it's based on which SQL operator ?
Same as ''contains'' {{{@>}}} but it's with case-insensitive or another
one ?

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:9>

Django

unread,
Oct 1, 2021, 12:28:45 AM10/1/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
--------------------------------------+------------------------------------
Reporter: Stephen Burrows | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:9 Sarah Abderemane]:


> I'd be happy to help on this issue but HStore is new for me,
{{{iexact}}} on HStoreField lookup, it's based on which SQL operator ?
> Same as ''contains'' {{{@>}}} but it's with case-insensitive or another
one ?

`iexact` and other text-lookups should work on
[https://github.com/django/django/blob/492ed60f236d770eb9a6d56d85ff2550bb1ecfff/django/contrib/postgres/fields/hstore.py#L79-L88
key transforms] on `HStoreField` because it returns `TextField`. Maybe
it's enough to add a similar note to the one about `JSONField`, e.g.:
{{{
.. note::

Key transforms can also be chained with: :lookup:`contains`,
:lookup:`icontains`, :lookup:`endswith`, :lookup:`iendswith`,
:lookup:`iexact`, :lookup:`regex`, :lookup:`iregex`,
:lookup:`startswith`,
and :lookup:`istartswith`.
}}}
This is untested so some tests will also be required.

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:10>

Django

unread,
Oct 1, 2021, 7:58:05 AM10/1/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned

Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Abderemane):

* owner: (none) => Sarah Abderemane


* status: new => assigned


Comment:

Thanks Mariusz, I'll try to see for that

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:11>

Django

unread,
Oct 3, 2021, 3:16:50 PM10/3/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/14930 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:12>

Django

unread,
Oct 4, 2021, 1:43:57 AM10/4/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"1953dd02b6719ee89fddbc3098d86968d79f3cd7" 1953dd0]:
{{{
#!CommitTicketReference repository=""
revision="1953dd02b6719ee89fddbc3098d86968d79f3cd7"
Refs #27694 -- Doc'd lookups that can be chained with HStoreField key
transforms.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:14>

Django

unread,
Oct 4, 2021, 1:44:00 AM10/4/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"533f345c09c935ce0117f52aa124599c52ffa80b" 533f345]:
{{{
#!CommitTicketReference repository=""
revision="533f345c09c935ce0117f52aa124599c52ffa80b"
Refs #27694 -- Added more tests for chaining lookups with HStoreField key
transforms.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:13>

Django

unread,
Oct 4, 2021, 1:44:51 AM10/4/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"7fa946c76b25ec84752d0ddf6d4afb0cfdc25c93" 7fa946c7]:
{{{
#!CommitTicketReference repository=""
revision="7fa946c76b25ec84752d0ddf6d4afb0cfdc25c93"
[4.0.x] Refs #27694 -- Doc'd lookups that can be chained with HStoreField
key transforms.

Backport of 1953dd02b6719ee89fddbc3098d86968d79f3cd7 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:15>

Django

unread,
Oct 4, 2021, 1:45:20 AM10/4/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"51e4dbfeb24d6b3bb1df6a328f8243761dba087a" 51e4dbfe]:
{{{
#!CommitTicketReference repository=""
revision="51e4dbfeb24d6b3bb1df6a328f8243761dba087a"
[3.2.x] Refs #27694 -- Doc'd lookups that can be chained with HStoreField
key transforms.

Backport of 1953dd02b6719ee89fddbc3098d86968d79f3cd7 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:16>

Django

unread,
Oct 4, 2021, 1:45:34 AM10/4/21
to django-...@googlegroups.com
#27694: Improve documentation of supported lookups on HStore & JSON fields
-------------------------------------+-------------------------------------
Reporter: Stephen Burrows | Owner: Sarah
Type: | Abderemane
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/27694#comment:17>

Reply all
Reply to author
Forward
0 new messages