[Django] #24928: Add UUIDField, RangeField, etc to database introspection

40 views
Skip to first unread message

Django

unread,
Jun 4, 2015, 7:57:17 PM6/4/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
django.db.backends.postgresql_psycopg2.introspection.DatabaseIntrospection.data_types_reverse
does not handle UUIDField and other core or contrib.postgres specific
fields. And neither does any of the other backends.

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

Django

unread,
Jun 4, 2015, 9:17:50 PM6/4/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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 timgraham):

* type: Bug => New feature
* stage: Unreviewed => Accepted


Comment:

There's an interesting question about how contrib.postgres can
"contribute" introspection rules to the postgres backend. Maybe the
contrib.postgres fields should be handled in a separate ticket.

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

Django

unread,
Jun 5, 2015, 5:47:13 AM6/5/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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 claudep):

IMHO, introspection should show the most accurate type, independently of
the presence of `contrib.postgres` in the INSTALLED_APPS.

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

Django

unread,
Jun 5, 2015, 9:22:30 AM6/5/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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 timgraham):

Claude, the issue in my mind is adding contrib references to
`django/db/backends/postgresql_psycopg2/introspection.py`. If we allow
`contrib.postgres` to play by special rules, that's not very friendly to
third-party apps that might wish to add introspection for their own
fields. But you have more experience in this area than I do, so please
give your thoughts if you had ideas on how this should work.

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

Django

unread,
Jun 5, 2015, 1:13:49 PM6/5/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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 claudep):

For me, this is not special rules, it's the rule "Django tries its best to
introspect the database fields". If anyone want to provide contrib.mysql
or contrib.oracle with custom fields, she's welcome to do so and we'll
also be able to improve introspection for those backends.

Currently Django outputs `models.TextField(blank=True, null=True) # This
field type is a guess.` for fields it doesn't know. Even if some field
type is not implemented by Django models, we could imagine that we provide
better hints (provided the type code is known), and point to popular
third-party packages which implements those fields, inside comments.

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

Django

unread,
Jun 5, 2015, 5:03:15 PM6/5/15
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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 timgraham):

What I envisioned for my proposal is a way for any app to contribute a
mapping to a particular database backend's
`DatabaseIntrospection.data_types_reverse` dictionary. I guess it might
work something like `south.modelsinspector.add_introspection_rules` does,
although I haven't looked at the implementation of that. Of course there's
also the need to add the appropriate import in the models file that
inspectdb generates since all fields won't be in `django.db.models`
anymore.

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

Django

unread,
Jul 18, 2016, 5:36:56 PM7/18/16
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection

-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
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
-------------------------------------+-------------------------------------

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

Django

unread,
Jul 19, 2016, 5:10:06 PM7/19/16
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: MarkusH | Owner: claudep
Type: New feature | Status: assigned

Component: Database layer | Version: master
(models, ORM) |
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 claudep):

* status: new => assigned
* owner: nobody => claudep


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

Django

unread,
Jul 20, 2016, 3:07:25 AM7/20/16
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------

Reporter: MarkusH | Owner: claudep
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
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 claudep):

As `UUIDField` is a bit different (available in all backends with
different implementation), I created a
[https://github.com/django/django/pull/6939 pull request] just for that
field.
A separate pull request will be proposed for other PostgreSQL-specific
fields.

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

Django

unread,
Jul 20, 2016, 8:20:47 AM7/20/16
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------

Reporter: MarkusH | Owner: claudep
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

The "final" [https://github.com/django/django/pull/6942 pull request],
including the commit linked from the previous comment and the fix for
#25454.

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

Django

unread,
Jul 20, 2016, 11:28:20 AM7/20/16
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------

Reporter: MarkusH | Owner: claudep
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Claude Paroz <claude@…>):

In [changeset:"3ea7167bb599536b48422d1fa841a2d378c98a4a" 3ea7167]:
{{{
#!CommitTicketReference repository=""
revision="3ea7167bb599536b48422d1fa841a2d378c98a4a"
Refs #24928 -- Added introspection support for UUIDField
}}}

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

Django

unread,
Sep 9, 2017, 12:27:27 PM9/9/17
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Claude
| Paroz

Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Claude Paroz <claude@…>):

In [changeset:"0cbb6ac00770d201b8f30a404d516b97fe41485d" 0cbb6ac0]:
{{{
#!CommitTicketReference repository=""
revision="0cbb6ac00770d201b8f30a404d516b97fe41485d"
Refs #24928 -- Added introspection support for PostgreSQL JSONField

Thanks Adam Johnson and Tim Graham for the reviews.
}}}

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

Django

unread,
Sep 9, 2017, 2:24:08 PM9/9/17
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------

Reporter: Markus Holtermann | Owner: Claude
| Paroz
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

Comment (by Claude Paroz <claude@…>):

In [changeset:"a599ae6018f748f66e774604d12989911ea09d33" a599ae60]:
{{{
#!CommitTicketReference repository=""
revision="a599ae6018f748f66e774604d12989911ea09d33"
Refs #24928 -- Added introspection support for PostgreSQL RangeField
}}}

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

Django

unread,
Sep 9, 2017, 2:51:43 PM9/9/17
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------

Reporter: Markus Holtermann | Owner: Claude
| Paroz
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* needs_better_patch: 0 => 1


Comment:

HStoreField and ArrayField support still missing.

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

Django

unread,
Dec 31, 2021, 1:44:42 AM12/31/21
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: (none)

Type: New feature | Status: new
Component: Database layer | Version: dev

(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: Claude Paroz => (none)
* status: assigned => new


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

Django

unread,
Mar 12, 2024, 4:52:57 AM3/12/24
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

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

Django

unread,
Nov 6, 2025, 7:08:48 AM (5 days ago) Nov 6
to django-...@googlegroups.com
#24928: Add UUIDField, RangeField, JSONField, etc to database introspection
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Mariusz
| Felisiak
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 1 => 0
* owner: (none) => Mariusz Felisiak
* status: new => assigned

Comment:

[https://github.com/django/django/pull/20063 PR for HStoreField]
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:16>
Reply all
Reply to author
Forward
0 new messages