Prefect Variables as Defaults in Pydantic Models I...
# prefect-ui
t
Prefect Variables as Defaults in Pydantic Models Is it possible to use a Prefect Variable to define a field's default value in a Pydantic Model? The flow run submission form should show the default as Prefect Variable, which is evaluated right before the submission of the flow. The Prefect variable should explicitly not be evaluated at deployment time. Use Case: • We have a set of parameters used across several flows, e.g., timeout. • We want different default values depending on the Prefect Workspace, e.g., a higher prd timeout than dev. • Prefect Variables give us and our operators a pleasant user experience to maintain those default values. • The still are able to choose a custom value instead of the variable.
c
I love this use case. And its something we've talked about recently. Currently, sadly no. Not at the deployment level. But you can when creating custom runs from the ui. You can pick "Select variable" and then pick a variable to use for that run. I'd love to bring this forward into the deployment to use variables as default values that wouldn't get evaluated until runtime. So please create an issue around your use case. Maybe we can get some traction around that.
t
Thanks for your feedback, submitted a feature request here: https://github.com/PrefectHQ/prefect/issues/12336
🙌 1