Opened 23 months ago
Closed 22 months ago
#34344 closed Cleanup/optimization (fixed)
PostGIS Database Backend Overrides features_class, ops_class and introspection_class
Reported by: | David Buhler | Owned by: | David Buhler |
---|---|---|---|
Component: | GIS | Version: | dev |
Severity: | Normal | Keywords: | geodjango postgis database backend |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
While working on adding PostGIS support to the django-multitenant library I had some issues with the features_class that was overridden in the DatabaseWrapper subclass. After some troubleshooting I was able to determine this is because the PostGIS backend explicitly sets the features
, ops
, and introspection
properties to the file local classes:
I was able to work around this behaviour by overriding the constructor and setting the features property explicitly:
This isn't very intuitive as other database backends will respect setting the _class
properties to instantiate classes.
Change History (8)
comment:1 by , 23 months ago
comment:2 by , 22 months ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Thanks for this ticket, however using features_class
, ops_class
, and introspection_class
will cause initializing PostGIS stuff for non-db connections (see 7e714827ead50f77aa82394cc2511ff96ab67fa4 and #16969) as they will be initialized in PsycopgDatabaseWrapper.__init__()
and NO_DB_ALIAS
-branch doesn't change anything anymore. Is there a way to use features_class
, ops_class
, and introspection_class
in a backward compatible way?
comment:3 by , 22 months ago
Hello Mariusz, I've updated the PR to be backwards compatible. In the init
method I've reset the *_class
properties to the original postgresql versions and moved the call to super().__init__(*args, **kwargs)
to below the conditional check for NO_DB_ALIAS
.
comment:4 by , 22 months ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
comment:5 by , 22 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 22 months ago
Has patch: | unset |
---|---|
Triage Stage: | Unreviewed → Accepted |
Here is a patch to fix the issue: https://github.com/django/django/pull/16563