@Marvin can you give me an example function to get specific deployment via name?
m
Marvin
09/16/2025, 2:05 PM
✅ thought for 39.9 seconds
Marvin
09/16/2025, 2:06 PM
Here are minimal examples for Prefect 3.x.
Async (recommended in most apps):
Copy code
from prefect.client.orchestration import get_client
# name must be "flow_name/deployment_name", e.g., "etl-flow/prod"
async def get_deployment_by_name(name: str):
async with get_client() as client:
return await client.read_deployment_by_name(name)
# Convenience wrapper if you have names separately
async def get_deployment(flow_name: str, deployment_name: str):
return await get_deployment_by_name(f"{flow_name}/{deployment_name}")
Sync version:
Copy code
from prefect.client.orchestration import SyncPrefectClient
def get_deployment_by_name_sync(name: str):
with SyncPrefectClient() as client:
return client.read_deployment_by_name(name)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.