<@ULVA73B9P> What method replaced the Prefect 1 ge...
# ask-marvin
r
@Marvin What method replaced the Prefect 1 get_key_value in Prefect 2?
m
I couldn't find specific information about the replacement for the
get_key_value
method from Prefect 1 in Prefect 2. It seems like the documentation search didn't yield relevant results for this specific query. However, Prefect 2 has shifted towards a more robust API and configuration management system, which might involve different ways of handling key-value storage or retrieval, possibly through environment variables or configuration files. For more specific guidance, you might want to explore Prefect 2's configuration and API management sections in their documentation: Prefect 2 Documentation. If you have more detailed requirements or context, feel free to share, and I can help further.
n
hi @Robert Esteves - there is no managed KV store in the same way as before now you'd use variables
@Marvin can you give a crash course on variables, get set delete etc
m
In Prefect 3.x, managing variables is quite straightforward and can be done through the Prefect UI, REST API, or CLI. Here's a quick rundown: ### Setting, Getting, and Deleting Variables 1. Through the Prefect UI: - Navigate to the Variables page in your Prefect server instance or Prefect Cloud workspace. - To create a new variable, click the
+
button, then enter the name and value. 2. Using the REST API: - You can create, set, get, and delete variables using the REST API by specifying the variable name or ID. Refer to the REST API documentation for more details. 3. Via the CLI: - `prefect variable set <name> <value>`: Creates or updates a variable. - `prefect variable get <name>`: Retrieves a variable's value. - `prefect variable unset <name>`: Deletes a variable. - `prefect variable ls`: Lists all variables. ### Important Considerations - Variables are mutable and can store any JSON type. - They are scoped to either a Prefect server instance or a Prefect Cloud workspace. - Not intended for sensitive information, as they are not encrypted. For a detailed guide, you can explore Prefect's documentation on variables here. ### Prefect API Overview Prefect's top-level API includes various functions and classes such as
flow
,
task
,
get_client
,
get_run_logger
, and more, which are essential for creating and managing flows and tasks. You can explore these in more detail in the Prefect 3.x API Documentation. If you have any specific use cases or questions, feel free to ask!
r
thanks Nate.
n
yep. marvin did not mention this, but there's a python interface to this too, like
Variable.set()
.get()
etc