Aiden Price
03/17/2023, 1:33 AMmy_block.save("my-block-slug")
.archive()
command like was possible for workflows in Prefect 1?sbrabez
03/17/2023, 7:58 AMapi/block_documents/{block_id}
because indeed block.delete("my-block-slug")
does not exist, it looks like the following snippet. You need to capture the block_id
from the result of save() function call
import requests
from prefect.settings import PREFECT_ORION_API_HOST, PREFECT_ORION_API_PORT
my_block_id = block.save("my-block-slug")
api_host = PREFECT_ORION_API_HOST
api_port = PREFECT_ORION_API_PORT
delete_block_api = f"http://{api_host}:{api_port}/api/block_documents/{my_block_id}"
response = requests.delete(delete_block_api)
response.raise_for_status()
It does the job for our use case but not sure if there is a better wayAiden Price
03/17/2023, 9:39 AMredsquare
03/17/2023, 9:40 AM