Hey all, does anyone know how can I retrieve an In...
# ask-community
j
Hey all, does anyone know how can I retrieve an Infrastructure object from Orion? I haven’t seen it covered in the docs
c
What do you mean retrieve?
What are you trying to do ?
j
@Christopher Boyd I’m trying to programmatically declare a deployment using a specific infrastructure
c
so you’re just trying to load an infrastructure block?
j
Here, I have a deployment that should use the docker container infra block. That
infra
there is “hardcoded”, I would like to retrieve the available one on my orion server
Copy code
deployment: Deployment = Deployment.build_from_flow(
        flow,
        name=deployment_name,
        output=output,  # type: ignore
        infrastructure=infra,
        path="/app",
        skip_upload=True,
    )
You would either need to know it, or retrieve your registered blocks
and override it
j
Aight, but how do I retrieve the blocks? I havent found the API to do so
you can do it from cli using
prefect blocks ls
via python, there are a couple block methods in prefect.client for reading/writing/updating
j
thank you!