How can I make a partitioned asset depend on a non...
# ask-ai
t
How can I make a partitioned asset depend on a non-partitioned upstream asset
s
To define a partitioned asset that depends on a non-partitioned upstream asset, you can simply reference the non-partitioned asset in the dependencies of the partitioned asset. In Dagster, when a partitioned asset is downstream of a non-partitioned asset, each partition of the downstream asset will automatically depend on the non-partitioned upstream asset. Here's an example from the documentation that illustrates how you can define such a dependency:
Copy code
python from dagster import asset, DailyPartitionsDefinition  # This is the non-partitioned upstream asset @asset def non_partitioned_upstream_asset():     # ... logic for non-partitioned asset ...     pass  # This is the partitioned downstream asset @asset(partitions_def=DailyPartitionsDefinition(start_date="2023-01-01")) def partitioned_downstream_asset(non_partitioned_upstream_asset):     # ... logic that depends on the non-partitioned asset ...     pass
In this example,
partitioned_downstream_asset
is a partitioned asset with daily partitions starting from January 1, 2023. It depends on the
non_partitioned_upstream_asset
, which is not partitioned. Dagster will infer that each partition of
partitioned_downstream_asset
depends on the
non_partitioned_upstream_asset
. This setup allows you to define dependencies between partitioned and non-partitioned assets without the need for additional configuration or partition mappings.