-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
GraphQL: Support for filtering on custom fields #7598
Comments
Another way might be via a graphql query on
(There's also
It would of course be good if such a query could be pushed down to a SQL condition in postgres, rather than making Netbox retrieve all objects from the database and discard the ones which don't match. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide. |
Blocked by #9856 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide. |
Blocked on #11949 |
Adding blocked until #9856 |
@arthanson Since #9856 is done, can you unblock this issue? Any ideas if and when this is now going to happen? |
I've marked this as "needs owner" for anyone who would like to take a stab at implementing this for v4.0 (with the new Strawberry GraphQL backend). @arthanson anything in particular you'd like to point out for this? |
I would like to take a stab at it :) Right now I am looking into extending |
@christophbeberweil thanks, I've assigned this to you. |
Hey @jeremystretch, I think I found a way to enable filtering of custom fields in GraphQL. My solution works by extending This works for Speaking of the Graph_i_QL frontend, while the backend detects my new filter When I create a new custom field After I restart the server, resolve_field raises an exception (AttributeError: 'NoneType' object has no attribute 'model') in Since these changes are not ready for merging, I did not open a merge request. Please consider this commit: ad78d04 Thanks :) |
Hi @jeremystretch, did you have a chance to look at my questions yet? Maybe you could indicate if my changes go in the right directopn from your point of view? Thanks |
@christophbeberweil I am not able to spend time on this, hence it being tagged for a volunteer. If you need help, I recommend reaching out to others in the community to see if they're able to assist. |
NetBox version
v3.0.3
Feature type
New functionality
Proposed functionality
There doesn't seem to be a way to filter based on custom fields in the GraphQL-api.
The documentation mentions "The GraphQL API employs the same filtering logic as the UI and REST API" so one approach would be to just follow the same pattern where
cf_foo_bar
etc are exposed as arguments for the list query of an entity wherefoo_bar
is a custom field.(Reference to discussion about this: #7569 )
Use case
We have the use for this when listing tenants via the graphql API. We put the customers name in the name field but we have a custom field where we have an internal identifier that is used as a reference when linking the data in netbox up with other systems though integrations.
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: