# ask-community

Clement Emmanuel

02/13/2023, 11:34 PM
Hey all, I'm trying to define a graph backed asset that is also partitioned, I think I may be misunderstanding something about the dagster data model for this scenario; it appears that the only op closures where i'm allowed access to the partition key (
) are the `op`s that are marked as producing a result output for the overarching graph. Ideally i'd like to just access this info from any op within the graph underlying the asset, not necessarily just the
that is supposedly producing the asset. Dummy example (please excuse, writing a simplified version of my problem by hand here, might not exactly compile but essentially looks like this):
Copy code
from dagster import graph, op, job, AssetsDefinition, DailyPartitionsDefinition

def root_op(context):
    # raises `dagster._check.CheckError: Failure condition: The output has no asset partitions`
    partition_date_str = context.asset_partition_key_for_output()

def leaf_op(root_op):
    return 1

def my_graph():
    return leaf_op(root_op())

AssetsDefinition.from_graph(my_graph, partitions_def=DailyPartitionsDefinition(start_date=DEFAULT_START))


02/13/2023, 11:40 PM
hi @Clement Emmanuel! this is definitely a bit of an odd quirk. but as for a solution, all asset outputs in a given run will share a partition key, and so you can instead just use
which does not care if the given asset is associated with an asset key or not.

Clement Emmanuel

02/13/2023, 11:48 PM
Ah wow thanks, perfect!
🌈 1