Jesse
07/28/2025, 12:49 PMMarvin
07/28/2025, 12:49 PMMarvin
07/28/2025, 12:50 PMpython
from prefect import flow, Variable
@flow
def my_flow():
my_var = Variable.get("my-variable")
print(f"The variable value is: {my_var}")
2. You can reference variables in your deployment configuration (prefect.yaml) for deployment-time customization:
yaml
deployments:
- name: my-deployment
flow_name: my-flow
parameters:
param1: "{{ prefect.variables.MY_VARIABLE }}"
If you need dynamic behavior that would typically be set in a decorator, the recommended approach is to:
1. Use deployment configurations to set variables
2. Access those variables within your flow using Variable.get()
3. Use control flow within your function based on those variables
Is there a specific use case you're trying to achieve with variables in decorators? That might help me provide more targeted guidance.