https://prefect.io logo
Title
a

Andreas

06/28/2022, 9:43 AM
Hi! In Prefect 2.0 - Python API orion client. How can we create and provide a flow_filter to read_deployments() ? For example how do I get all deployments that have a specific tag using Python? It would be nice if the API docs had more examples especially related to Python API and client
1
m

Mathijs Carlu

06/28/2022, 10:10 AM
The following looks for all deployments that are tagged "DeploymentHasThisTag":
from prefect.orion.schemas.filters import DeploymentFilter, DeploymentFilterTags
tag_filter = DeploymentFilterTags(all_=['DeploymentHasThisTag'])
filter = DeploymentFilter(tags=tag_filter)
b = await client.read_deployments(deployment_filter=filter)
❤️ 1
Might be useful to look at the REST API, where you can more easily "click open" the required contents, which are actually just json representations of the Python objects
a

Andreas

06/28/2022, 10:16 AM
Thanks that was what I was looking for!
a

Anna Geller

06/30/2022, 1:32 PM
cc @terrence feedback to have more examples on using Orion client
❤️ 1
t

terrence

06/30/2022, 2:16 PM
more API examples are on the roadmap