How can I extend a block class?

I’ve tried to make something like this to the Azure block:

class GzippedAzure(Azure):

It seems to work just fine, but I get this warning during runtime and it got me wondering if this is the right way to do this:

/lib/python3.10/site-packages/prefect/utilities/ UserWarning: Type ‘GzippedAzure’ at ./blocks/ has key ‘azure’ that matches existing registered type ‘Azure’ from /home/ivarec/.local/lib/python3.10/site-packages/prefect/ The existing type will be overridden.

So, what’s the right way to do this?

It’s a fair warning clarifying that the type will be changed which sounds legit since you seem to be changing it to gzip

It might be because _block_type_name attribute on the new block is the same.


Worked perfectly. The only caveat is that I had to delete my block instance of Azure and recreate it as GzippedAzure via UI.


Note: if you are doing something similar, don’t forget to add the @sync_compatible decorator to your async method overrides.