Hi! In Prefect 2.0 - Python API orion client. How ...
# ask-community
a
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
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
Thanks that was what I was looking for!
a
cc @terrence feedback to have more examples on using Orion client
❤️ 1
t
more API examples are on the roadmap