Python SDK Reference
variables
prefect.variables
Classes
Variable
Variables are named, mutable JSON values that can be shared across tasks and flows.
Args:
name
: A string identifying the variable.value
: A string that is the value of the variable.tags
: An optional list of strings to associate with the variable.
Methods:
set
Sets a new variable. If one exists with the same name, must pass overwrite=True
Returns the newly set variable object.
Args:
-
: The name of the variable to set.-
: The value of the variable to set.-
: An optional list of strings to associate with the variable.-
: Whether to overwrite the variable if it already exists.
get
Get a variable’s value by name.
If the variable does not exist, return the default value.
Args:
-
: The name of the variable value to get.-
: The default value to return if the variable does not exist.
unset
Unset a variable by name.
Args:
-
: The name of the variable to unset.
Returns True
if the variable was deleted, False
if the variable did not exist.