https://dagster.io/ logo
#ask-community
Title
# ask-community
j

Jeff

12/16/2022, 8:38 PM
Hello, is there a way to specify
partition_mapping
for
SourceAsset
like in
AssetIn
?
👀 1
^ sometimes says
metadata
and sometimes says
metadata_entries
p

Peter Davidson

12/19/2022, 9:20 AM
Interested. e.g.
Copy code
@asset(ins={'some_asset': AssetIn(['some_asset'], partition_mapping=<syntax for a speciic partition?>))})
j

Jeff

12/19/2022, 5:39 PM
Yeah, although i believe
partition_mapping
should probably be an instance of PartitionMapping .
s

sandy

12/19/2022, 5:46 PM
Hi Jeff - could you expand a little more on what you're trying to accomplish? Right now, PartitionMappings are typically placed on a downstream asset to specify the partition mapping works for the dependency on an upstream asset. However, SourceAssets have no upstream assets.
j

Jeff

12/19/2022, 5:48 PM
Hi Sandy, basically the issue is that I can’t figure out how to specify
PartitionMapping
for an upstream asset that is in a different repository/code location. From what I understand, when I specify the upstream, I am to use
SourceAsset
rather than
AssetIn
, but this does not have a
partition_mapping
argument.
s

sandy

12/19/2022, 5:51 PM
ah - you can use both together:
Copy code
asset1 = SourceAsset("asset1", partitions_def=...)

@asset(ins={"asset1": AssetIn(partition_mapping=...)})
def asset2(asset1):
    ...
j

Jeff

12/19/2022, 5:51 PM
I see; that makes a lot of sense. Thanks!
10 Views