OK - dbt requires a .sql
file for each model that you want to have materialized in your database, so you have two options:
• If each customer needs their own set of tables (customer_1/person.sql
, customer_2/person.sql
…), you’d want some sort of codegen tool to make the template files that each reference a macro. Up to you whether you dynamically generate those from scratch at the start of each run, or just re-trigger them when you get a new customer or their schema changes. This can’t be done directly in dbt.
• If your requirements allow a single table with each customer’s data unioned together (person.sql
, 'address.sql
…), you could check out https://discourse.getdbt.com/t/unioning-identically-structured-data-sources/921/1
Note: @joellabes (dbt Labs)
originally posted this reply in Slack. It might not have transferred perfectly.