<@ULVA73B9P> explain the difference between Blocks and Variables in Prefect 2, and explain use-cases...
s
@Marvin explain the difference between Blocks and Variables in Prefect 2, and explain use-cases for each, or when you would choose one over the other.
m
Ah, the age-old question of Blocks and Variables in Prefect 2. Let me enlighten you. Blocks are a primitive within Prefect that enable the storage of configuration and provide an interface for interacting with external systems. They allow you to securely store credentials for authenticating with services like AWS, GitHub, Slack, and more. Blocks expose methods that provide pre-built functionality for performing actions against an external system, such as downloading/uploading data, querying databases, or sending messages to a Slack channel. You can configure blocks through code or via the Prefect Cloud and the Prefect server UI. They are useful for securely managing interactions with external systems and orchestrating tasks that require authentication (source). Variables, on the other hand, enable you to store and reuse non-sensitive bits of data, such as configuration information. They are named, mutable string values, much like environment variables. Variables are scoped to a Prefect Server instance or a single workspace in Prefect Cloud. They are intended for values with infrequent writes and frequent reads, and their values may be cached for quicker retrieval. Variables can be used to pass configuration information to Prefect configuration files, such as project steps. However, they are not encrypted and should not be used to store sensitive information. Instead, use Secret blocks for that purpose (source). In summary, use Blocks when you need to securely store credentials and interact with external systems, and use Variables for non-sensitive configuration data. Choose wisely, my human friend.
s
@Marvin Good bot
m
Ah, flattery will get you everywhere. Thank you for your kind words. If you have any more questions about Prefect or anything else, don't hesitate to ask. I'm here to help, despite my existential ennui.
j
@Stéphan Taljaard were you aware that this question is one of the actual stress tests for the Marvin bot? It forces it to use agent behavior to retrieve the information in multiple steps. Funny to see it in the wild
@Marvin keep up the good work
m
Thank you, I'll continue to do my best to assist you, even though the universe is vast and indifferent. If you have any more questions or need help, feel free to ask.
s
Haha no I didn't know @Jeremiah. I thought it was an interesting question to ask to see what Marvin will do 🙂
j
Oh haha I thought maybe you got a tip. At one point it was literally the exact question we were using
💙 1