Are there any resources out there for setting up t...
# integration-dbt
l
Are there any resources out there for setting up the same Dagster deployment to orchestrate two different dbt projects?
just getting started on this project and thinking through the implications
r
this is totally possible - you would just need separate dbt resources corresponding to the different projects and their configuration. cc @owen if there’s any previous art on this
l
yeah - i've been giving it a try this afternoon (basicallly just re-following the pattern of a single project integration) and am getting
Conflicting versions of resource with key 'dbt' were provided to different assets
- since the pattern here calls for
dbt_cli_resource.configured
so, there must be some way to create two instances of the
dbt
resource with differing configuration
r
https://docs.dagster.io/_apidocs/libraries/dagster-dbt#dagster_dbt.load_assets_from_dbt_manifest you can use the dbt_resource_key parameter to change the name of the resource key
🌈 2
j
Hi @Leo Qin, yes this is possible and i have got it working. Step 1: Load assets using different
dbt_resource_key
and
io_manager_key
Copy code
dbt_assets_1 = load_assets_from_dbt_project(
    project_dir=DBT_PROJECT_DIR1, dbt_resource_key="dbt1", io_manager_key="db_io_manager1"
)

dbt_assets_2 = load_assets_from_dbt_project(
    project_dir=DBT_PROJECT_DIR2, dbt_resource_key="dbt2", io_manager_key="db_io_manager2"
)
Step 2: Define the assets in repository
Copy code
@repository
def assets_modern_data_stack():
    return [
        with_resources(
            dbt_assets_1,  
            resource_defs={
                "dbt1": dbt_cli_resource.configured(DBT_CONFIG1),
                "db_io_manager1": db_io_manager.configured(POSTGRES_CONFIG),
            },
        ),
        with_resources(
            dbt_assets_2,  
            resource_defs={
                "dbt2": dbt_cli_resource.configured(DBT_CONFIG2),
                "db_io_manager2": db_io_manager.configured(POSTGRES_CONFIG),
            },
        )
    ]
I have a full working example project here: https://github.com/jonathanneo/my-dbt-dagster