What I mean particularly, is that some of the alte...
# ask-community
b
What I mean particularly, is that some of the alternatives don't seem to link up: These assets are partitioned on a static list of values and, as best I can tell from the docs, the only way to set up a partitioned asset is via the
partitions_def
argument to the
@asset
decorator. If I want to add metadata to a materialisation, the docs only mention how to do it via an
op
based asset or from a custom IO manager. So I could make them an
op
in a graph-backed asset maybe? But I can't see any docs on how to partition graph-backed assets? (I know you can actually because I went digging in the source for
AssetsDefinition.from_graph()
but it's not at all clear from the docs)
s
I know that one way you can log metadata is via the
context.add_output_metadata
method, which will log whatever is in the dict to the AssetMaterialization event that running the asset produces. I'm not sure how this plays with partitions yet.
Copy code
@asset
def my_asset(context):
    context.add_output_metadata({"how_cool": "so_cool"})
    return [1, 2, 3]
Also, my understanding is that all assets are "op-backed" assets. Under the hood, @asset is basically an @op with superpowers
🌈 1
c
Hi Ben! In addition to what Stephen mentioned, you can also add metadata to an asset materialization by doing something like this:
Copy code
yield Output(5, metadata={"my_metadata": 5})
I can file a ticket to document partitioning graph-backed assets
@Dagster Bot docs no documentation for partitioned graph-backed assets
d
c
@Dagster Bot docs missing documentation for attaching metadata to asset materialization
d
b
Thanks Stephen and Claire! To be clear, I don't think any actual functionality is missing here but I found myself chasing my tail a bit through the docs on this one
c
Definitely--thanks Ben for reporting these gaps. Docs improvements are important to us and we definitely want to improve our coverage. Please feel free to report future questions / docs issues!
b
Yup will do. Overall, I think they're already really good btw. I don't normally have to spend very much time in there to find what I need
🌈 1