How to make use of DBT in a multi tenant environment with same set of model files

Hi Team,

We have multi tenant environment for each customer (Separate DB for each customer). How to enable the DBT model with in a DBT project. I am not sure how to dynamically change the DB environment.


Hi ganaruna. I am in a similar situation. I have a data model that I am currently using with one client, but I want to generalize the solution and expand to more in the future.

I have not done this step yet, but my plan is to create DBT packages for the different modules and then have separate DBT models for each client.

I will probably do it in a similar way as how the DBT fb package handled stitch and fivetran:

They have one base file that is actually a macro with the SQL code.

And then in the final model they use the macro:

So in my package I will create macros for all the most common tables.

In my client models, I will execute the macro and then select from the result. This way I can still make modifications of adjustments to those models.

Or maybe I won’t make them macros and instead make them transient models and then select from those.

Would love to hear how other people are solving this problem.