#33825 closed Cleanup/optimization (wontfix)
Stop allowing 'django.db.backends.postgresql_psycopg2' in DATABASES
Reported by: | Maxim Danilov | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.0 |
Severity: | Normal | Keywords: | db.backend |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
"django.db.backends.postgresql_psycopg2"
This backend was renamed in Django 1.9.
https://docs.djangoproject.com/en/4.0/internals/deprecation/#deprecation-removed-in-3-0
The django.db.backends.postgresql_psycopg2 module will be removed.
VERSION = (4, 1, 0, "beta", 1)
django.db.utils.py
function load_backend() ... # rows 100 - 110 if backend_name == "django.db.backends.postgresql_psycopg2": backend_name = "django.db.backends.postgresql"
i understand, that means "backwards compatibility". But not in this case: renamed in 1.9, removed in 3.xx. It may no longer be needed in 4.xx, the third major generation of Django after 1.9.
Change History (4)
comment:1 by , 2 years ago
Easy pickings: | unset |
---|---|
Summary: | postgresql_psycopg2 still remains → Stop allowing 'django.db.backends.postgresql_psycopg2' in DATABASES |
follow-up: 3 comment:2 by , 2 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
OK, I'm going to say wontfix
for now. I don't see the value of the disruption — I suspect a lot of people would need to update their settings if we removed the shim. That seems needlessly disruptive.
Happy if someone wants to argue differently. (I'm a bit -0)
I think reviewing this again for cleanup as a part of #33308 makes sense. (When adding Psycopg3 there's some gain to pay for the disruption so... 🤷♀️)
comment:3 by , 2 years ago
Replying to Carlton Gibson:
OK, I'm going to say
wontfix
for now. I don't see the value of the disruption — I suspect a lot of people would need to update their settings if we removed the shim. That seems needlessly disruptive.
Happy if someone wants to argue differently. (I'm a bit -0)
I think reviewing this again for cleanup as a part of #33308 makes sense. (When adding Psycopg3 there's some gain to pay for the disruption so... 🤷♀️)
if you suspect "a lot of people would need to update their settings if we removed the shim" - probably we can add warning in backend:
if backend_name == "django.db.backends.postgresql_psycopg2": # here we can put output warning for wrong named backend backend_name = "django.db.backends.postgresql"
comment:4 by , 2 years ago
Yes. Absolutely. And that would be the the deprecation path, if we decided to go that way.
My point was more, I don't think this is worth the disruption at this stage, prior to #33308.
(If there's a consensus to remove it then fair enough, otherwise I'd say let's revisit when adding Psycopg3 support.)
While not documented, the shim still provides backward compatibility for using that name in the
DATABASES
setting. Whether it could be removed or should be formally deprecated could be debated. At some point, Django won't support psycopg2 anymore (#33308 is for adding psycopg3 support) which will make the alias meaningless.