Skip to content

How can I load the materialized contents of a specific partition of an asset? #14417

Answered by OwenKephart
OwenKephart asked this question in Q&A
Discussion options

You must be logged in to vote

This can be accomplished using load_asset_value.

For example:

@asset(partitions_def=DailyPartitionsDefinition(start_date="2022-01-01")
def my_asset():
    ...

@op(...)
def my_op():
    from my_dagster_project import defs

    dates = ["2022-01-01", "2022-01-02", ...]
    with defs.get_asset_value_loader() as loader:
        for date in dates:
            value = loader.load_asset_value(AssetKey("my_asset"), partition_key=date)
            do_something_with(value)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dmsfabiano
Comment options

@OwenKephart
Comment options

@dmsfabiano
Comment options

@OwenKephart
Comment options

@dmsfabiano
Comment options

Answer selected by OwenKephart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants