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

Marti Mutso

03/17/2023, 7:25 AM
Hello, Is there any way to define a PartitionMapping for a dbt asset?
dagster bot responded by community 1
a

Adam Bloom

03/17/2023, 12:11 PM
Both asset load functions include arguments that can be used to pass partitions definitions and variables mappings: https://docs.dagster.io/_apidocs/libraries/dagster-dbt#dagster_dbt.load_assets_from_dbt_project
m

Marti Mutso

03/17/2023, 12:49 PM
PartitionsDefinitions, yes, but PartitionMapping, I don’t see any way. For example, how to pass config for LastPartitionMapping, which is usually done something like this:
Copy code
from dagster import DailyPartitionsDefinition, TimeWindowPartitionMapping, AssetIn, asset

partitions_def = DailyPartitionsDefinition(start_date="2020-01-01")

@asset(partitions_def=partitions_def)
def asset1():
    ...

@asset(
    partitions_def=partitions_def,
    ins={
        "asset1": AssetIn(
            partition_mapping=LastPartitionMapping()
        )
    }
)
def asset2(asset1):
    ...
6 Views