Join two databases in one model
Put web sessions next to store sales when they live in different DuckDB files.
web_analytics.duckdb has sessions and page events. retail.duckdb has sales and the customer, product and date tables. Neither knows about the other.
-
Choose File › New › New model and select both files. Each gets an alias, such as
retailandweb_analytics. -
The draft proposes joins from sessions to customers and dates because the column names match. They are marked to check, since nothing declares them.
-
Check each join’s target and types. If the names differ in your files, add the join yourself.
-
Save, and grant use of the model.
-
Make a table with Month, Sessions and Net amount.
Why the numbers are right
Sessions and sales are aggregated separately by month and then lined up. No session is counted once per sale.
When a column won’t go in
Grouping both by Device fails, because sales have no device. The block names the pair. Use fields both sides can reach: dates, customers, and their attributes.
Conversion
Add a model calculation, [Sales orders] / [Sessions], using whichever count of orders your model has. It works at any level that both tables reach.



