<@ULVA73B9P> in the latest version of prefect how ...
# marvin-in-the-wild
j
@Marvin in the latest version of prefect how do I set up variables? The How-To-Guide says to use
from prefect import variables.Variable
which immediately gives an error. Did this change in 2.0?
m
The concept of "variables" in Prefect 2.x has evolved from the way they existed in Prefect 1.0. In Prefect 2.x (the latest versions), variables are essentially mutable strings that can be used to store non-sensitive data, such as configuration information, and are scoped to a Prefect server instance or workspace in Prefect Cloud. You can manage variables through the Prefect UI, API, and CLI, and they are intended for values that are read frequently but written infrequently. They're similar to environment variables and are not encrypted, hence not suitable for sensitive information like credentials—for which you should use Secret blocks. It appears there has been a change in how variables are set up and handled from Prefect 1.0 to 2.0 since there indeed used to be a
Variable
object that you could import. The use of
Variable
is not the way to handle variables in Prefect 2.x. You should refer to the Prefect Variables guide for more detailed instructions on how to work with variables in the current version. If you're migrating from Prefect 1.0 to Prefect 2.x, it might be useful to check out the migration guide, which provides comprehensive information on what changes to expect and how to adapt your workflows.