Hello Prefect! 👋
I have a classic deployment like this in the screenshot. The variables in input are defined with a Pydantic class as usual.
I like to see them populated like here, but I don't really want to change them.
Is it possible to make variables readonly?
Mattia Sappa
01/27/2025, 3:13 PM
For example,
Dbt Project Dir
could be greyed out but visible. So I can see it, but I can't modify it.
b
Bianca Hoch
01/27/2025, 10:37 PM
Hey Mattia! I'm not sure if that's something that we support yet 🤔 . FWIW, I tried creating a frozen dataclass and I could still override the parameters. Maybe there's something I'm missing here though.
Copy code
from pydantic import BaseModel, Field
from prefect import flow
class User(BaseModel):
name: str = Field(frozen=True)
@flow(log_prints=True)
def hello_world(user: User):
print(f"Hello {user.name} from Prefect! 🤗")
if __name__ == "__main__":
user = User(name="Friend")
hello_world.serve(
name="hello-world-deployment",
tags=["example"],
parameters={"user": user},
)
Bianca Hoch
01/27/2025, 10:37 PM
Mind sharing a bit more about why you'd like to grey out these values? Could be a nice feature request!
m
Mattia Sappa
01/28/2025, 11:07 AM
Hi @Bianca Hoch, thank you for trying!
In our environment, we always have deployments with multiple of these inputs that we never change. They are defined, hardcoded, in code, but we like to have them there in the UI to have a confirmation that the settings are correct.
Now, I am onboarding a less technical person who is a bit concerned by such parameters. Having the option to make them readonly would make both happy 🙂
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.