Georgi Milanov
04/22/2024, 12:03 PMMarvin
04/22/2024, 12:04 PMprefect block register --module MODULE_NAME
For example, to register all blocks found in the credentials
module within Prefect Integrations, you would use:
prefect block register --module prefect_aws.credentials
Registering blocks for use in Prefect UI
2. Register a block from a Python file using:
prefect block register --file FILE_PATH.py
Replace FILE_PATH.py
with the path to your Python file that contains your block definition.
Prefect Docs - Registering blocks
3. Install relevant libraries and register the blocks they provide. For example:
pip install -U LIBRARY_NAME
prefect block register -m LIBRARY_NAME
Then, create the block in the Prefect UI or via code.
Storage guide - How to use Blocks
4. Handling updates to custom Block types: In case your custom block needs an additional field or modification, you can edit the class definition and register the updated block type. If you have existing blocks of this type that were created before the update, you can migrate them by adding the missing values using load
with validate=False
.
Updating custom Block types
Make sure to check the documentation links for detailed steps and additional information. Remember to use these commands in the proper environment where your self-hosted Prefect server is accessible.