Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can dbt connect to different databases in the same project?

Tags:

dbt

It seems dbt only works for a single database.

If my data is in a different database, will that still work? For example, if my datalake is using delta, but I want to run dbt using Redshift, would dbt still work for this case?

like image 994
Willie Chen Avatar asked Dec 15 '25 05:12

Willie Chen


2 Answers

To use dbt, you need to already be able to select from your raw data in your warehouse.

In general, dbt is not an ETL tool:

[dbt] doesn’t extract or load data, but it’s extremely good at transforming data that’s already loaded into your warehouse. This “transform after load” architecture is becoming known as ELT (extract, load, transform). dbt is the T in ELT. [reference]

So no, you cannot use dbt with Redshift and Deltalake at the same time. Instead, use a separate service to extract and load data into your Redshift cluster — dbt is agnostic about which tool you use to do this.

There is a nuance to this answer - you could use dbt to select from external files in S3 or GCS, so long as you've set up your data warehouse to be able to read those files. For Redshift, this means setting up Redshift Spectrum. (For Snowflake, this means setting up an external table and on BigQuery, you can also query cloud storage data)

So, if the data you read in Deltalake lives in S3, if you set up your Redshift cluster to be able to read it, you can use dbt to transform the data!

like image 113
Claire Carroll Avatar answered Dec 16 '25 21:12

Claire Carroll


You can use Trino with dbt to connect to multiple databases in the same project.

The Github example project https://github.com/victorcouste/trino-dbt-demo contains a fully working setup, that you can replicate and adapt to your needs.

like image 28
Victor Coustenoble Avatar answered Dec 16 '25 22:12

Victor Coustenoble



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!