[Django] #22022: Allow field subclasses to require additional SQL

9 views
Skip to first unread message

Django

unread,
Feb 12, 2014, 5:35:46 AM2/12/14
to django-...@googlegroups.com
#22022: Allow field subclasses to require additional SQL
-------------------------------------+-------------------------------------
Reporter: mjtamlyn | Owner: nobody
Type: New | Status: new
feature | Version: master
Component: Database | Keywords:
layer (models, ORM) | Has patch: 1
Severity: Normal | Needs tests: 0
Triage Stage: | Easy pickings: 0
Unreviewed |
Needs documentation: 0 |
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
'''Problem'''

In postgres, a number of data types require a specific extension to be
installed. We have one instance of this in core at present, which is the
`postgis` extension. Our documentation recommends[1] (in postgres 9.1+)
that you explicitly create the extension in your primary database by hand,
and then we customise the `_create_test_db` method on the postgis database
backend to ensure the test database has the relevant extensions installed.

Other third party apps[2] recommend adding the extension to the template
to ensure it's present in tests.

I wish to avoid adding a custom backend to d.c.postgres if at all
possible, especially as using it in conjunction with gis should be
permissible. Consequently, I'd like if possible for model fields to have
`pre_create_sql` to allow each individual field to create the extensions
as needed. The same mechanism could also be used for a user defined custom
field to create functions which could then be used as a custom transform
object.

This feature will be useful for:
1) one part of the de-hack-gis project
2) hstore
3) citext, trigrams, generating uuids database side and other possible
future features of d.c.postgres

I've written a draft patch[3]. It probably needs some work (hence patch
needs improvement) but an initial review of the names and code layout
would be useful.

[1]
https://docs.djangoproject.com/en/1.6/ref/contrib/gis/install/postgis/#creating-a
-spatial-database-with-postgis-2-0-and-postgresql-9-1
[2] https://github.com/djangonauts/django-hstore#running-the-tests
[3] https://github.com/django/django/pull/2266

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

Django

unread,
Feb 12, 2014, 6:19:17 PM2/12/14
to django-...@googlegroups.com
#22022: Allow field subclasses to require additional SQL
-------------------------------------+-------------------------------------
Reporter: mjtamlyn | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by russellm):

* stage: Unreviewed => Accepted


Comment:

In principle, sounds like a reasonable proposition to me. There's clearly
some discussion happening on the pull request, but I suspect that this
will only shape the final form of the feature, not the base functionality.

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

Django

unread,
Sep 6, 2014, 2:56:25 PM9/6/14
to django-...@googlegroups.com
#22022: Allow field subclasses to require additional SQL
-------------------------------------+-------------------------------------
Reporter: mjtamlyn | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Description changed by nemesisdesign:

Old description:

New description:

'''Problem'''

[1]
https://docs.djangoproject.com/en/1.6/ref/contrib/gis/install/postgis/#creating-a
-spatial-database-with-postgis-2-0-and-postgresql-9-1
[2] http://djangonauts.github.io/django-hstore/#_running_tests
[3] https://github.com/django/django/pull/2266

--

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

Django

unread,
May 21, 2015, 3:15:13 PM5/21/15
to django-...@googlegroups.com
#22022: Allow field subclasses to require additional SQL
-------------------------------------+-------------------------------------
Reporter: mjtamlyn | Owner: nobody
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 timgraham):

* status: new => closed
* resolution: => wontfix


Comment:

Marc on the pull request, "I'm going to give up on this concept in favour
of manual Operations."

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

Reply all
Reply to author
Forward
0 new messages