Can dbt use different database as source and join them together?

Hi All,
plan to use dbt to connect to different type of database and join them together to create the model. is that possible? like if i have snowflake database and sql server database, i want to create dbt model and need to join data from two database together. Want to know the possibility.(i am using dbt cloud)

Thanks,
Alex

Its not possible. dbt can connect to a single target.

1 Like

You first need to put all the data in the same database (snowflake or sql server).

thanks for the reply. got it. so it is not possible to connect two database at same time.
sir, are you familiar with semantic layer feature, wondering if this is something you can help? i have another post and link is below, trying to make semantic feature work on dbt cloud.
how to add time_grants to metrics yml files - Help - dbt Community Forum (getdbt.com)

We are on an old dbt versiĆ³n without the semantics features, so I canā€™t help you with that.
But ok, maybe thereā€™s a a forced solution using linked servers. I donā€™t recommend doing joins with tables between servers but that could help, maybe you can do that in two steps, first create a stage local table with a simple query to the linked server and as a second step you can do the join.
We use MS SQL and we load data with dbt using the linked server feature of another MS SQL without problems.
Here is an example:

version: 2
sources:

  • name: asourcename
    database: ā€˜LINKEDSERVERNAME"."DATABASENAMEā€™

Hope it helps.

I believe still we will not be able to read data from multiple servers at one go right ?

I have been trying to read 2 tables which come from 2 different Oracle servers. It seems it is not possible.

yes, its not possible as dbt only works with the data that is already loaded into target data warehouse. dbt project can only connect to one target data warehouse.

Hello,
I think use dbt to connect to different types of databases and join them together to create a model. Is this possible? can I join data from a Snowflake database and a SQL Server database in a dbt model? Iā€™m using dbt Cloud and would like to know if this is feasible.