Repository navigation
Conversation
Filter entity lists by exact label on server using 'filter' argument of 'entityLists' (AYON server 1.8.3+), with client side fallback for older servers. Empty 'labels' or 'list_ids' iterables return nothing.
BigRoy
commented
Nov 14, 2026
| client_labels = labels | ||
| fields.add("label") | ||
| else: | ||
| filters["filter"] = json.dumps({ |
Member
Author
There was a problem hiding this comment.
I wonder if it actually'd make sense to also expose filters itself 🤔
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Add a
labelsargument toget_entity_liststo filter entity lists by exact label match on the server.Additional info
Finding a few lists by label meant fetching every list in the project and filtering on the client, 300 lists per GraphQL page. On projects with thousands of lists that takes many sequential requests, and the number of requests grows as more lists are created.
get_entity_lists(project_name, *, list_ids=None, labels=None, active=None, fields=None).QueryFilter(labelin[...]) via thefilterargument ofproject.entityLists. Labels are unique per project and indexed, so this is a single cheap request.labelsiterable returns nothing, the same as an emptylist_ids.list_idsis now converted to a set before the emptiness check, so an empty generator also returns nothing; before, it returned all lists._api.pyregenerated withautomated_api.py.Expected to ship in ayon-python-api 1.2.29.
Testing notes:
pytest tests/test_entity_lists_labels.pychecks that the filter is sent to the server on 1.8.3+, that labels are filtered on the client below 1.8.3, and that empty labels send no request.pytest tests/test_review_tasks_lists_api.py -k entity_lists_by_labelsruns both the server-side path and the forced client-side fallback. It covers exact match, case sensitivity, quotes,%/_characters, unknown labels and empty input.labels=. All paths returned the same lists.