You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when listing events you can filter them by using a EventFilter object in JSON format. This allows you to search for events based on the event name, resource, related resource.
However the engine is quite opinionated with regards to how the filter is then used to query the database. For example when using related nodes by specifying an EventRelatedFilter we can see that we can specify a list of key-pairs of prefect.resource.role and prefect.resource.id in the resources_in_roles attribute. The resulting query is then using sa.or_ as seen here:
For my use-case I'd want this to be an sa.and_ instead, and while I don't expect a breaking change here it would be nice to be able to control this behaviour. Perhaps by introducing a resources_in_roles_operation which would default a value indicating sa.or_ but that you could then set to sa.and_.
The goal would be to use the resources_in_roles as a constraint to further filter the events to a smaller set instead of including additional events for each pair of role and resource_id.
Example Use
No response
Additional context
It looks like the /api/automation/filter supports this concept of operator in one location.
The text was updated successfully, but these errors were encountered:
ogenstad
changed the title
Expand filtering options for /api/events/filter
Expand filtering options for resources_in_roles in /api/events/filter
Feb 5, 2025
Describe the current behavior
Currently when listing events you can filter them by using a EventFilter object in JSON format. This allows you to search for events based on the event name, resource, related resource.
However the engine is quite opinionated with regards to how the filter is then used to query the database. For example when using related nodes by specifying an EventRelatedFilter we can see that we can specify a list of key-pairs of
prefect.resource.role
andprefect.resource.id
in theresources_in_roles
attribute. The resulting query is then usingsa.or_
as seen here:Describe the proposed behavior
For my use-case I'd want this to be an
sa.and_
instead, and while I don't expect a breaking change here it would be nice to be able to control this behaviour. Perhaps by introducing aresources_in_roles_operation
which would default a value indicatingsa.or_
but that you could then set tosa.and_
.The goal would be to use the
resources_in_roles
as a constraint to further filter the events to a smaller set instead of including additional events for each pair of role and resource_id.Example Use
No response
Additional context
It looks like the /api/automation/filter supports this concept of operator in one location.
The text was updated successfully, but these errors were encountered: