Ability to filter objects by an associated request ID #11494
Labels
status: accepted
This issue has been accepted for implementation
type: feature
Introduction of new functionality to the application
Milestone
NetBox version
v3.4.2
Feature type
New functionality
Proposed functionality
Add new filters to
NetBoxModelFilterSet
which enable a user to filter for objects based on the ID and action of an associated change record. For example, suppose you want to find all sites that were created as the result of a specific request. This proposal would enable you to filter send a request such as:This filter would perform two lookups:
Although we're making two queries, overhead shouldn't be too bad as the first is returning only the related object IDs. However we probably want to add a database index for the
request_id
column.(I'm open to suggestions regarding the specific filter name. I'd like to avoid using the term "change request" as that could be very confusing to the user.)
Use case
The initial catalyst for this idea came from #10242, which seeks to optimize our approach for returning newly-imported objects. However, this functionality will likely find many additional use cases.
Shout-out to @DanSheps who first proposed this strategy.
Database changes
Add an index for
extras_objectchange.request_id
to optimize queries. This can be accomplished using a simple migration.External dependencies
No response
The text was updated successfully, but these errors were encountered: