I'm trying to use a `MultiPartitionMapping` that i...
# ask-community
d
I'm trying to use a
MultiPartitionMapping
that is more-or-less just the identity mapping.
Copy code
@asset(
    required_resource_keys={"duckdb"},
    ins={
        "historical_daily": AssetIn(
            partition_mapping=MultiPartitionMapping(
                {
                    "days": DimensionPartitionMapping(
                        dimension_name="days",
                        partition_mapping=TimeWindowPartitionMapping(
                            start_offset=-window, end_offset=0
                        )
                    ),
                    "dynamic_partition": DimensionPartitionMapping(
                        dimension_name="dynamic_partition",
                        partition_mapping=IdentityPartitionMapping()
                    ),
                }
            )
        )
    },
    partitions_def=MultiPartitionsDefinition(
        {
            "days": DailyPartitionsDefinition(
                timezone="Etc/UTC",
                start_date=spec[0]["start_date"]["inner"],
                end_offset=-1
            ),
            "dynamic_partition": dynamic_partition
        }
    ))
With the upstream asset having more-or-less the identical partitions_def as the downstream. I'm getting the following error.
Copy code
Selected assets must have the same partitions definitions, but the selected assets have different partitions definitions: 
Multi-partitioned, with dimensions: 
Days: Daily, starting 2019-09-10 Etc/UTC. End offsetted by -1 partitions. 
Dynamic_partition: Dynamic partitions: "dynamic_partition": {AssetKey(['key'])}
Multi-partitioned, with dimensions: 
Days: Daily, starting 2019-09-10 Etc/UTC. End offsetted by -1 partitions. 
Dynamic_partition: Dynamic partitions: "dynamic_partition": {AssetKey(['other_key'])}
🤖 1
c
Hi Drew. This error occurs when the partitions defs of assets selected for a job defined via
define_assets_job
are not equivalent python objects. Would you mind sharing partitions def of the upstream asset so I can reproduce this? I think if you did
Copy code
assert key.partitions_def == other_key.partitions_def
this assertion would fail, I'm curious to see why
d
I was able to fix this one by just setting a variable = the partition definition and reusing it between assets. I think I had a str for a date in one and a datetime in the other. Thanks for your help claire.
🌈 1