Renaming the postgresql_psycopg2 backend

258 views
Skip to first unread message

Baptiste Mispelon

unread,
Jul 15, 2015, 9:17:30 AM7/15/15
to django-d...@googlegroups.com
Hi everyone,

After starting a new project recently and failing three times to type
the name of the postgres backend correctly, I was wondering if there's
really any value in keeping around this strange name.

From what I understand, it's a historical artifact from a time when
there was more than one postgres backend.


Could we at least make it an alias of a more simply named "postgresql"
backend?


Thanks,
Baptiste

Federico Capoano

unread,
Jul 15, 2015, 9:20:12 AM7/15/15
to django-d...@googlegroups.com
I would definitely second this.

Andriy Sokolovskiy

unread,
Jul 15, 2015, 9:24:04 AM7/15/15
to django-d...@googlegroups.com
Good proposal.
If there will be release of psycopg3, which will work without serious
changes to django codebase, this old name can bring more confusion, so need
to deprecate this.

Collin Anderson

unread,
Jul 15, 2015, 9:30:03 AM7/15/15
to django-d...@googlegroups.com
We definitely should make sure postgresql_psycopg2 still works as expected. As a data point, Heroku uses "postgres" instead of "postgresql" in their DATABASE_URL scheme. Maybe we could support all three? :)

Baptiste Mispelon

unread,
Jul 26, 2015, 4:21:14 AM7/26/15
to django-d...@googlegroups.com
I finally got around to creating a ticket for this: https://code.djangoproject.com/ticket/25175
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3ab4f912-fc25-4859-bd8d-5651e2c68e93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim Graham

unread,
Jan 23, 2017, 2:50:03 PM1/23/17
to Django developers (Contributions to Django itself)
The 'django.db.backends.postgresql' alias was added in Django 1.9 along with import shims in the old location: django.db.backends.postgresql_psycopg2 [0]. I'd like to remove the import shims at some point [1] (but keep the two line shim in django/db/utils.py that allows using DATABASES 'ENGINE': 'django.db.backends.postgresql_psycopg2' indefinitely, given the minimal cost). Do you think subclassing and extending the built-in backend is a common enough use case that it's worth formally deprecating the postgresql_psycopg2 module rather than simply removing it in Django 2.0?

[0] https://github.com/django/django/commit/bcb4fe0012f8f869348ea83f5a35706f4545c44a
[1] https://github.com/django/django/pull/7938

Adam Johnson

unread,
Jan 23, 2017, 3:19:51 PM1/23/17
to django-d...@googlegroups.com
For reference the lines doing the fixup in django/db/utils.pyhttps://github.com/django/django/blob/master/django/db/utils.py#L108

I'm fine with simply removing it rather than putting it through the deprecation process - I don't think subclassing database backends is a big enough usecase, given that it's not even documented.

To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/416e2f39-8c05-4db7-975f-a5dc16380598%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Adam

Raffaele Salmaso

unread,
Jan 24, 2017, 2:50:51 AM1/24/17
to django-d...@googlegroups.com
On Mon, Jan 23, 2017 at 8:50 PM, Tim Graham <timog...@gmail.com> wrote:
but keep the two line shim in django/db/utils.py that allows using DATABASES 'ENGINE': 'django.db.backends.postgresql_psycopg2' indefinitely, given the minimal cost
I prefer to remove all references, and have an explicit error on unavailable backend.

--

Claude Paroz

unread,
Jan 24, 2017, 2:55:23 AM1/24/17
to Django developers (Contributions to Django itself)
Le lundi 23 janvier 2017 20:50:03 UTC+1, Tim Graham a écrit :
(...) Do you think subclassing and extending the built-in backend is a common enough use case that it's worth formally deprecating the postgresql_psycopg2 module rather than simply removing it in Django 2.0?

I am generally strongly against simply dropping non-internal stuff. In those cases, I would be for a short deprecation period (without pending deprecation) so as at least those who follow the good practice of checking their test suite is deprecation-free on Django n before upgrading to Django n + 1 can have a good experience.

Claude

Josh Smeaton

unread,
Jan 24, 2017, 5:46:56 AM1/24/17
to Django developers (Contributions to Django itself)
I remembered a thing from Michaels talk at #DUTH. Let me present a use case for subclassing a backend:


I think if we end up favouring immediate deprecation, we could proactively find and inform backend maintainers that would be affected. Their users might not be so appreciative though. I think Claude's position is a good one. A short deprecation period at a minimum.

For my own interest I just did a quick search on PyPI for `django postgres` and found the following (having various levels of django version support):

Adam Johnson

unread,
Jan 24, 2017, 6:39:32 AM1/24/17
to django-d...@googlegroups.com
Ok fair point, I agree it should go through the short deprecation process. It's also very small and not that bothersome to keep around.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.

For more options, visit https://groups.google.com/d/optout.



--
Adam

Tim Graham

unread,
Jan 24, 2017, 1:25:59 PM1/24/17
to Django developers (Contributions to Django itself)
Okay, I updated the PR to use a deprecation. I'd rather not complicate things with an accelerated deprecation.


On Tuesday, January 24, 2017 at 6:39:32 AM UTC-5, Adam Johnson wrote:
Ok fair point, I agree it should go through the short deprecation process. It's also very small and not that bothersome to keep around.
On 24 January 2017 at 10:46, Josh Smeaton <josh.s...@gmail.com> wrote:
I remembered a thing from Michaels talk at #DUTH. Let me present a use case for subclassing a backend:


I think if we end up favouring immediate deprecation, we could proactively find and inform backend maintainers that would be affected. Their users might not be so appreciative though. I think Claude's position is a good one. A short deprecation period at a minimum.

For my own interest I just did a quick search on PyPI for `django postgres` and found the following (having various levels of django version support):

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.



--
Adam

Aymeric Augustin

unread,
Jan 25, 2017, 4:49:44 AM1/25/17
to django-d...@googlegroups.com
On 24 Jan 2017, at 19:25, Tim Graham <timog...@gmail.com> wrote:

Okay, I updated the PR to use a deprecation. I'd rather not complicate things with an accelerated deprecation.

+1

I think that’s the right way.

-- 
Aymeric.

Reply all
Reply to author
Forward
0 new messages