# One Excel workbook from Postgres, DuckDB and Databricks | DRE

> Combine queries from several databases into one Excel file: each tab runs on its own connection (PostgreSQL, DuckDB, Databricks), in a single run.

[← All use cases](https://getdre.com/use-cases/)

# One workbook from three systems

The numbers for one pack live in different places: stores in a local DuckDB file, the product catalogue in Postgres, locations in Databricks. You want one workbook, not three exports glued together by hand. Declare the tables as sources once, with the connection each lives on, and every query runs where its tables are.

Recorded from a real run: dre ls shows each tab’s connection offline, then one run reads DuckDB, Postgres and Databricks.

Recorded from a real run: dre ls shows each tab’s connection offline, then one run reads DuckDB, Postgres and Databricks.

[↓ Download the workbook (three\_engines.xlsx)](https://getdre.com/media/downloads/three_engines.xlsx)

sources/shop.yml

```yaml
version: 2
sources:
  - name: shop
    profile: shop_duck
    schema: main
    tables: [{name: stores}]
  - name: shop_pg
    profile: shop_pg
    schema: public
    tables: [{name: products}]
  - name: career_vista
    profile: databricks_oauth
    database: workspace
    schema: career_vista
    tables: [{name: locations}]
```

reports/three\_engines/three\_engines.yml

```yaml
queries:
  - {query: tri_duck_stores, tab_name: DuckDB}
  - {query: tri_pg_products, tab_name: Postgres}
  - {query: tri_databricks_locations, tab_name: Databricks}
output:
  format: xlsx
  destination:
    - {profile: local, path: "out/three_engines-{{ run.date.yyyymmdd }}.xlsx"}
```

reports/three\_engines/tri\_pg\_products.sql

```sql
select '{{ connection.type }}' as engine, count(*) as products
from {{ source('shop_pg', 'products') }}
```

terminal

```bash
dre ls -s three_engines
dre run three_engines
```

### What to notice

-   A source names its connection; a query that reads it runs there. The report names none.
-   One session per connection, opened when its first query needs it; queries still run one at a time, in YAML order.
-   Sources follow dbt's format, so a dbt sources.yml pastes in; profile: is the one addition.
-   dre ls and the manifest show each tab's connection without connecting; dre run -s source:shop\_pg.products runs every report that reads a table.

### In the docs

-   [Connections and targets →](https://getdre.com/docs/connections/)
-   [Sources →](https://getdre.com/docs/sources/)
-   [Upgrading to 0.2 →](https://getdre.com/docs/migrating-to-0.2/)

## More use cases

[

### A report built by a coding agent

From “help me with dre” to a delivered file, with an agent as the guide.

](https://getdre.com/use-cases/built-by-a-coding-agent/)[

### See every upcoming run

dre schedule ls lists when every schedule fires, with DST worked out, and the exact command for each run.

](https://getdre.com/use-cases/see-every-upcoming-run/)[

### A headline in Slack, the workbook attached

The numbers people actually read, posted to a channel, built from the same queries as the Excel file.

](https://getdre.com/use-cases/daily-headline-to-slack/)
