I try to transform some additional information, su...
# dagster-feedback
l
I try to transform some additional information, such as database's schema and table name, from asset to io_manager, this is my code:
Copy code
from dagster import IOManager, io_manager

class MyIOManager(IOManager):
    def handle_output(self, context, str):
        <http://context.log.info|context.log.info>(context.metadata)
    
    def load_input(self, context):
        pass

@io_manager()
def my_io_manager(init_context):
    return MyIOManager()

@asset(io_manager_key='my_io_manager')
def asset1(context):
    <http://context.log.info|context.log.info>(context.run_id)
    return Output('this is mine', metadata={'label': 'mylabel'})
but the log show context's metadata in handle_output is empty. What's worry with these code? Is this a right way to transform additional information from asset to io_manager?
s
hi @li liang - is the metadata not known until runtime? if you know it ahead of time, you can include it in the arguments to the decorator:
Copy code
@asset(io_manager_key='my_io_manager', metadata={...})
def asset1(context):
    <http://context.log.info|context.log.info>(context.run_id)
    ...
here's the issue where we're tracking the ability to access dynamic metadata: https://github.com/dagster-io/dagster/issues/9076 btw, in the future, the #dagster-support channel would be a better place for this kind of question
l
Thanks very much, the metadata is known ahead of time, I will try add them in '@asset'.