Skip to content

Commit

Permalink
[docs] - Document asset metadata [CON-31] (#8084)
Browse files Browse the repository at this point in the history
* First pass at asset metadata

* Address review comments

* Update example, run snapshot

* Add page name

* Running scripts
  • Loading branch information
erinkcochran87 committed Jun 8, 2022
1 parent 0215e82 commit 3c8d1bf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/content/concepts/assets/software-defined-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ def downstream_asset(upstream):

In this case, `ins={"upstream": AssetIn("upstream_asset")}` declares that the contents of the asset with the key `upstream_asset` will be provided to the function argument named `upstream`.

### Attaching metadata

Dagster supports attaching arbitrary [metadata](/\_apidocs/ops#dagster.MetadataEntry) to assets. To attach metadata, supply a `metadata` dictionary to the asset:

```python file=/concepts/assets/asset_metadata.py startafter=start_example endbefore=end_example
@asset(metadata={"cereal_name": "Sugar Sprinkles"})
def cereal_asset():
return 5
```

Asset metadata can be viewed in Dagit on the [Asset Detail page](/concepts/dagit/dagit#asset-details).

### Using context in assets

Since a software-defined asset contains an op, all of the typical functionality of an op (like the use of resources) is available to an asset.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from dagster import asset

# start_example


@asset(metadata={"cereal_name": "Sugar Sprinkles"})
def cereal_asset():
return 5


# end_example

1 comment on commit 3c8d1bf

@vercel
Copy link

@vercel vercel bot commented on 3c8d1bf Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.