What is the best way to have a partitioned graph b...
# ask-community
d
What is the best way to have a partitioned graph backed asset depend on the latest materialization of some other (non-partitioned) asset?
dagster bot responded by community 1
j
I have defined something like this:
Copy code
@asset(
    key_prefix=KEY_PREFIX,
    ins={
        'types_mapping': AssetIn(
            key=[KEY_PREFIX, 'types_mapping'],
            partition_mapping=LastPartitionMapping()
        )
    }
)
And type_mapping is daily partitioned asset 😉
But from What you describe you need to have it the other way: In that case it should be simple asset dependency
d
Even if the upstream asset has no partitions?
j
yes, if the input is not partitioned there shouldn't be a problem
d
That looks like it should work, but when I try and materialize a downstream partition, I get an error saying it cannot be materialized because upstream partitions are missing
j
is upstream partition materialized too?
d
Yes
but I put the asset
in
for the graph backed part, and then passed it as a param to the op
but that might not be right
j
could you show the error or definition of your assets?
d
its basically like:
Copy code
@asset
def asset1():
 ...

@op
def op1(asset1):
 ....

@graph_asset(
  partitions_def=HourlyPartition(...),
  ins = {
     'asset1': AssetIn('asset1', partition_mapping = LastPartitionMapping())
  }
)
def g1(asset1):
  op1(asset1)
Sorry for the retype, I can't copy and paste from the environment
j
in that case you don't need partition_mapping as your upstream is not partitioned.
d
and passing it plain just works... headbang I just made it way too complicated
thank you!
👍 1