Hi All, How can I set a root path or url on the m...
# ask-community
Hi All, How can I set a root path or url on the metadata I marked in the screenshot below? Thanks for your help
Without seeing your underlying code, these metadata entries are usually emitted by the IO Manager. See https://docs.dagster.io/_apidocs/ops#dagster.MetadataValue What IO Manager are you using? Did you write a custom one? The default
emits the absolute path as metadata (see screenshot example)
Also taking the chance to plug #dagster-de 🙂
🌈 1
I use UPathIOManager, thanks for pointing me the right direction. With UPathIOManager you just override get_metadata in your child class.
Copy code
def get_metadata(
    context: OutputContext,  # pylint: disable=unused-argument
    obj: Any,  # pylint: disable=unused-argument
) -> Dict[str, MetadataValue]:
    """Child classes should override this method to add custom metadata to the outputs."""
    return {}
The UPathIOManager is already logging the full path
yes it does 👍. but e.g. I would like to prepend (local minio) to the path and have a MetadataValue.url(), so I can click on it and immediately inspect the file in browser, without copy pasting. maybe there is a better way to do it but I found a workaround where I override
Copy code
def dump_to_path(self, context: OutputContext, obj, path: UPath):

    # Note: this is a workaround to have the path available when overriding the get_metadata method
    self.path = path
since dump_to_path is called first in handle_output I have it available as soon as get_metadata is called. this way i do not need to override too much.
I see, makes sense