Connect to external databases #10832

Closed
opened 2025-12-29 21:36:25 +01:00 by adam · 1 comment
Owner

Originally created by @fmluizao on GitHub (Feb 28, 2025).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

4.1.11

Feature type

Data model extension

Proposed functionality

I have a very specific use case, I'm developing a plugin, and I need to query an external DB.

I thought about being able to define the connection on configuration.py and them merging with Netbox's default db

Here's POC:

ce478be456

Would you accept a PR for this?

Use case

You can create a model in a plugin which can query other databases, like

class MyPluginModel(models.model):
   # ...

MyPluginModel.objects.using('otherdbconnection')

Maybe we can even define a custom router to avoid using:

https://docs.djangoproject.com/en/5.2/topics/db/multi-db/#using-routers

Database changes

No response

External dependencies

No response

Originally created by @fmluizao on GitHub (Feb 28, 2025). Originally assigned to: @jeremystretch on GitHub. ### NetBox version 4.1.11 ### Feature type Data model extension ### Proposed functionality I have a very specific use case, I'm developing a plugin, and I need to query an external DB. I thought about being able to define the connection on `configuration.py` and them merging with Netbox's default db Here's POC: https://github.com/fmluizao/netbox/commit/ce478be45646d73dca69a522d72e4933187c2ad3 Would you accept a PR for this? ### Use case You can create a model in a plugin which can query other databases, like ```python class MyPluginModel(models.model): # ... MyPluginModel.objects.using('otherdbconnection') ``` Maybe we can even define a custom router to avoid `using`: https://docs.djangoproject.com/en/5.2/topics/db/multi-db/#using-routers ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:36:26 +01:00
adam closed this issue 2025-12-29 21:36:26 +01:00
Author
Owner

@Leo-scs commented on GitHub (Feb 28, 2025):

Can you please approve this PR? It would be something very important and useful to use in Netbox

@Leo-scs commented on GitHub (Feb 28, 2025): Can you please approve this PR? It would be something very important and useful to use in Netbox
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10832