QuackUIInstall

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.

  1. Choose File › New › New model and select both files. Each gets an alias, such as retail and web_analytics.

    Choosing sources for a model
  2. The draft proposes joins from sessions to customers and dates because the column names match. They are marked to check, since nothing declares them.

    A proposed join to check
  3. Check each join’s target and types. If the names differ in your files, add the join yourself.

  4. Save, and grant use of the model.

  5. Make a table with Month, Sessions and Net amount.

    Sessions and sales by month
The finished report

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.