[Django] #27162: Move CreateExtension to django.db.backends.postgresql

37 views
Skip to first unread message

Django

unread,
Aug 31, 2016, 11:48:49 AM8/31/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New | Status: new
feature |
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 |
-------------------------------------+-------------------------------------
The CreateExtension currently lives in
`django.contrib.postgres.operations`. I think that it's a core
functionality of the PostgreSQL backend and it should be usable without
requiring contrib.postgres. PostGIS users might want to use it to add
extensions in migrations. I therefore suggest to move it to a new location
inside `django.db.backends.postgresql`. Backwards compatibility is kept as
`CreateExtension` will still be imported from the same module it is
defined in currently.

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

Django

unread,
Aug 31, 2016, 11:51:49 AM8/31/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
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:

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

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

Django

unread,
Aug 31, 2016, 8:13:56 PM8/31/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

Comment (by timgraham):

I understand the purity behind the rationale, but the new import path
(`django.db.backends.postgresql.migrations.operations.CreateExtension`)
seems a bit unwieldy. I guess the pattern looks better for third-party
backends that don't have "django.db.backends" in the import path. Also, I
think this is the first time we would have users importing code directly
from a database backend. I guess that's a more common pattern for third-
party backends which may provide custom fields. It raises the question why
we have `contrib.postres` instead of putting that in the backend though.

Is it impossible to import from the current location without adding
`contrib.postgres` to `INSTALLED_APPS`?

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

Django

unread,
Sep 1, 2016, 4:29:46 AM9/1/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

Comment (by claudep):

You are right, adding `contrib.postgres` to `INSTALLED_APPS` is not
required, and this indeed makes my patch rather moot :-/
Do you agree about keeping the `docs/ref/contrib/gis/install/postgis.txt`
and `docs/ref/databases.txt` additions from the patch (with paths
corrected)?

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

Django

unread,
Sep 1, 2016, 8:59:59 AM9/1/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

Comment (by timgraham):

Sure, adding the documentation is okay.

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

Django

unread,
Sep 1, 2016, 9:20:23 AM9/1/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

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


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

Django

unread,
Sep 1, 2016, 10:00:26 AM9/1/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
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:"6b54504e667da3f6bc53b887ffd7e8cc113a94b1" 6b54504]:
{{{
#!CommitTicketReference repository=""
revision="6b54504e667da3f6bc53b887ffd7e8cc113a94b1"
Refs #27162 -- Complemented docs related to CreateExtension

Thanks Tim Graham for the review.
}}}

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

Django

unread,
Sep 1, 2016, 2:07:39 PM9/1/16
to django-...@googlegroups.com
#27162: Move CreateExtension to django.db.backends.postgresql
-------------------------------------+-------------------------------------
Reporter: claudep | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"0a81f540c9ad94301bbdf615a216ee8bffbceac7" 0a81f54]:
{{{
#!CommitTicketReference repository=""
revision="0a81f540c9ad94301bbdf615a216ee8bffbceac7"
[1.10.x] Refs #27162 -- Complemented docs related to CreateExtension

Thanks Tim Graham for the review.

Backport of 6b54504e667da3f6bc53b887ffd7e8cc113a94b1 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages