Is it possible to assign multiple IO Managers to a...
# ask-community
x
Is it possible to assign multiple IO Managers to an asset? I would like to materialize an asset to multiple backing storages. Thank you in advance!
y
cc @sandy
One workaround is to have a “master” IOManager which materializes an asset to multiple storages in its
handle_output
. You can make it depend on other io managers using resource-to-resource dependencies, such as:
Copy code
@io_manager(required_resource_keys={"other_io_manager_1", "other_io_manager_2"})
def master_io_manager(init_context):
    other_io_manager_1 = init_context.resources.other_io_manager_1
    other_io_manager_2 = init_context.resources.other_io_manager_2
    return MasterIOManager(other_io_manager_1, other_io_manager_2)

class MasterIOManager(IOManager):

    def handle_output(self, context, obj):
        context.resources.other_io_manager_1.handle_output(context, obj)
        context.resources.other_io_manager_2.handle_output(context, obj)
EDIT: we currently don’t have native support for multiple IO Managers to an asset.
x
Thank you for the workaround - this can work for now! thankewe Is there any plan to have native support for multiple IO Managers to an asset?
y
@Dagster Bot issue support multiple IO Managers to an asset
d
y
I don’t think we have a plan at the moment, but I filed a feature-request issue for tracking
thank you box 1