Implement DATABASE_ENGINE Configuration Parameter #7661

Closed
opened 2025-12-29 20:26:35 +01:00 by adam · 3 comments
Owner

Originally created by @nick-bogle on GitHub (Feb 20, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

v3.4.4

Feature type

New functionality

Proposed functionality

I am proposing introduction of a DATABASE_ENGINE parameter, which would allow overwriting the default database engine of 'django.contrib.gis.db.backends.postgresql' to a custom database backend.

This would be an optional configuration parameter within the configuration.py file. In the event METRICS_ENABLED was also set, I propose we give the DATABASE_ENGINE option priority. If DATABASE_ENGINE is not set, and METRICS_ENABLED is set to True, then the database engine would be set to 'django_prometheus.db.backends.postgresql'

Use case

This would allow extending the netbox datamodel with different Postgres database extensions, for example to support PostGIS to allow geospatial data models.

Database changes

No database changes.

External dependencies

No external dependencies until a database engine was overwritten, in which case that engine may potentially have external dependencies.

Originally created by @nick-bogle on GitHub (Feb 20, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version v3.4.4 ### Feature type New functionality ### Proposed functionality I am proposing introduction of a DATABASE_ENGINE parameter, which would allow overwriting the default database engine of 'django.contrib.gis.db.backends.postgresql' to a custom database backend. This would be an optional configuration parameter within the configuration.py file. In the event METRICS_ENABLED was also set, I propose we give the DATABASE_ENGINE option priority. If DATABASE_ENGINE is not set, and METRICS_ENABLED is set to True, then the database engine would be set to 'django_prometheus.db.backends.postgresql' ### Use case This would allow extending the netbox datamodel with different Postgres database extensions, for example to support PostGIS to allow geospatial data models. ### Database changes No database changes. ### External dependencies No external dependencies until a database engine was overwritten, in which case that engine may potentially have external dependencies.
adam added the status: acceptedtype: feature labels 2025-12-29 20:26:35 +01:00
adam closed this issue 2025-12-29 20:26:35 +01:00
Author
Owner

@nick-bogle commented on GitHub (Feb 20, 2023):

If approved, I am happy to take ownership and complete the PR for this feature. This would allow plugins like this to be used: https://github.com/wholesailnetworks/netbox-geo

@nick-bogle commented on GitHub (Feb 20, 2023): If approved, I am happy to take ownership and complete the PR for this feature. This would allow plugins like this to be used: https://github.com/wholesailnetworks/netbox-geo
Author
Owner

@jeremystretch commented on GitHub (Feb 27, 2023):

Just a minor note: We probably want to add an ENGINE parameter to the existing DATABASE config (as opposed to establishing a separate setting), e.g.:

DATABASE = {
    'ENGINE': 'my.custom.backend',
    'NAME': 'netbox',
    'USER': 'netbox', 
    ...
}

To confirm, this would default to django.db.backends.postgresql (or, if METRICS_ENABLED is true, django_prometheus.db.backends.postgresql), but be overridden by any user-specified value.

I don't believe there's anything precluding this from being implemented in v3.4, so I'll assign it you @nick-bogle. Thanks!

@jeremystretch commented on GitHub (Feb 27, 2023): Just a minor note: We probably want to add an `ENGINE` parameter to the existing `DATABASE` config (as opposed to establishing a separate setting), e.g.: ``` DATABASE = { 'ENGINE': 'my.custom.backend', 'NAME': 'netbox', 'USER': 'netbox', ... } ``` To confirm, this would default to `django.db.backends.postgresql` (or, if `METRICS_ENABLED` is true, `django_prometheus.db.backends.postgresql`), but be overridden by any user-specified value. I don't believe there's anything precluding this from being implemented in v3.4, so I'll assign it you @nick-bogle. Thanks!
Author
Owner

@jeremystretch commented on GitHub (Mar 16, 2023):

@nick-bogle are you still planning to work on this?

@jeremystretch commented on GitHub (Mar 16, 2023): @nick-bogle are you still planning to work on this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7661