Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DATABASE_ENGINE Configuration Parameter #11791

Closed
nick-bogle opened this issue Feb 20, 2023 · 3 comments · Fixed by #12458
Closed

Implement DATABASE_ENGINE Configuration Parameter #11791

nick-bogle opened this issue Feb 20, 2023 · 3 comments · Fixed by #12458
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@nick-bogle
Copy link

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.

@nick-bogle nick-bogle added the type: feature Introduction of new functionality to the application label Feb 20, 2023
@nick-bogle
Copy link
Author

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

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Feb 27, 2023
@jeremystretch
Copy link
Member

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 jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 27, 2023
@jeremystretch
Copy link
Member

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

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation and removed status: accepted This issue has been accepted for implementation labels May 3, 2023
@abhi1693 abhi1693 self-assigned this May 3, 2023
@abhi1693 abhi1693 added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels May 3, 2023
abhi1693 added a commit that referenced this issue May 3, 2023
jeremystretch pushed a commit that referenced this issue May 4, 2023
* adds ENGINE to database config #11791

* fixed lint issues

* updated doc
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants