Skip to content

chatBI demo#74

Draft
daria-sukhareva wants to merge 5 commits intomainfrom
demo
Draft

chatBI demo#74
daria-sukhareva wants to merge 5 commits intomainfrom
demo

Conversation

@daria-sukhareva
Copy link
Copy Markdown
Collaborator

@daria-sukhareva daria-sukhareva commented Mar 29, 2026

my kwwhat project has only dbt pipeline for now. I want to add a demo that should work like a services spin off by docker-compose.
The first service would be duckdb containing all of the sample data and eventually dimensional models. Sample data should be in RAW database and models in ANALYTICS.
The second service would be dbt-core running kwwhat locally with duckdb connector pointing to the first service. For kwwhat running locally over duckdb check ../kilowatt-tycoon
The third service will be running chat BI by nao labs that calls dbt-core service for MCP and pointing to mart models in duckdb. For chat BI tool running locally check ../kwwhat-chat-BI
For demo example check ../datavow-contracts
Start with the execution plan. Don’t make any changes yet.

What the Semantic Layer gives you — instead of nao just reading raw table columns, it now has access to
your 10 named metrics (uptime, first_attempt_success_rate, troubled_success_rate, etc.) with their proper
business definitions. When you ask "what was uptime last week?" it queries through MetricFlow using your
curated logic, not a raw SQL guess.

The distinction is architectural:

  ┌─────────────────┬───────────────────────────────┬───────────────────────────┐
  │                 │             stdio             │         HTTP/SSE          │
  ├─────────────────┼───────────────────────────────┼───────────────────────────┤
  │ Server location │ Same process/machine          │ Any network location      │
  ├─────────────────┼───────────────────────────────┼───────────────────────────┤
  │ Multi-client    │ No                            │ Yes                       │
  ├─────────────────┼───────────────────────────────┼───────────────────────────┤
  │ Setup           │ Simpler                       │ Requires a running server │
  ├─────────────────┼───────────────────────────────┼───────────────────────────┤
  │ Use case        │ Local tools, IDE integrations │ Shared/remote servers     │
  └─────────────────┴───────────────────────────────┴───────────────────────────┘

For our demo, stdio is the right call: dbt-mcp runs inside the chat-bi container alongside nao, no networking needed. The
SSE approach we tried before was overengineered for this use case — it added socat, port forwarding, and healthcheck
complexity just to cross a container boundary that no longer exists.

The only reason you'd want HTTP/SSE for dbt-mcp is if multiple different clients (different users, different tools) needed
to share one running dbt-mcp instance. That's a production multi-user deployment concern, not a demo concern.

Comment on lines +24 to +25
├── docker-compose.yml
├── .env.example
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - these files make total sense

Create /demo inside kwwhat with the following layout:

```
demo/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daria-sukhareva is demo folder name what you saw in other projects?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw one but there demo and dbt (a folder with a pipeline) were on the same level. I will give this a try and maybe change it later. I can not decide for now.

Comment on lines +41 to +51
Phase 2 — Service 1: duckdb-init (init container)

Goal: Populate /data/raw.duckdb with seed CSV data so dbt can read from RAW.SEED.*.

- Base image: python:3.12-slim
- Installs: duckdb (Python package)
- Mounts: ../seeds:/seeds:ro (kwwhat's CSV seed files), duckdb-data:/data
- init.py creates raw.duckdb, attaches it as catalog RAW, creates schema SEED, loads:
- RAW.SEED.ocpp_1_6_synthetic_logs_14d from ocpp_1_6_synthetic_logs_14d.csv
- RAW.SEED.ports from ports.csv
- Exits 0 when done (docker-compose service_completed_successfully condition)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense

Comment on lines +54 to +70
Phase 3 — Service 2: dbt (dbt-core + dbt-mcp)

Goal: Run dbt build against DuckDB, write marts to ANALYTICS, then serve as MCP endpoint.

- Base image: python:3.12-slim
- Installs: dbt-duckdb, dbt-mcp (via pip/uvx)
- Mounts: ../:/kwwhat:ro, duckdb-data:/data
- profiles.yml configured with:
- Main path: /data/analytics.duckdb (target database ANALYTICS)
- attach: /data/raw.duckdb as alias RAW
- entrypoint.sh:
a. Wait for /data/raw.duckdb to exist
b. dbt deps
c. dbt build (seed is skipped — seeds already loaded by Service 1 into RAW)
d. dbt-mcp in HTTP/SSE mode on :8080, local mode (no dbt Cloud)
- Healthcheck: HTTP GET :8080 responds
- Exposes port 8080
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense


Key config for dbt-mcp local mode:
DISABLE_REMOTE=true
DISABLE_SEMANTIC_LAYER=true (no SL in local DuckDB)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what is this flag. @daria-sukhareva you should check if it makes sense to you

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eugene-mobile ok thank you for catching this

Comment on lines +79 to +91
Phase 4 — Service 3: chat-bi (nao-core)

Goal: Interactive chat BI connected to mart models in DuckDB, using dbt-core as MCP.

- Base image: python:3.12-slim
- Installs: nao-core==0.0.59
- Mounts: duckdb-data:/data
- nao_config.yaml: DuckDB connection to /data/analytics.duckdb, schema main, include fact_* and dim_* —
requires verifying nao supports DuckDB (currently only Snowflake in kwwhat-chat-BI — this is the biggest
open question)
- mcp.json: connects to Service 2 MCP via HTTP/SSE http://dbt:8080/sse
- entrypoint.sh: wait for Service 2 healthcheck → nao chat
- stdin_open: true, tty: true (interactive terminal)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep - makes sense

Comment on lines +94 to +118
Phase 5 — docker-compose.yml

services:
duckdb-init:
build: ./duckdb-init
volumes: [duckdb-data:/data, ../seeds:/seeds:ro]

dbt:
build: ./dbt
depends_on:
duckdb-init: { condition: service_completed_successfully }
volumes: [duckdb-data:/data, ../:/kwwhat:ro]
ports: ["8080:8080"]
healthcheck: { test: curl http://localhost:8080 }

chat-bi:
build: ./chat-bi
depends_on:
dbt: { condition: service_healthy }
volumes: [duckdb-data:/data]
stdin_open: true
tty: true

volumes:
duckdb-data:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will orchestrate all of the docker images. Totally makes sense

Comment on lines +121 to +128
Phase 6 — run-demo.sh

Orchestration script:
1. docker compose build
2. docker compose up duckdb-init (wait for completion)
3. docker compose up dbt -d (background, wait for healthy)
4. docker compose run --rm chat-bi (interactive session)
5. Teardown instructions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Copy link
Copy Markdown
Contributor

@eugene-mobile eugene-mobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a solid plan

@daria-sukhareva daria-sukhareva changed the title demo plan chatBI demo Mar 30, 2026
@daria-sukhareva daria-sukhareva marked this pull request as draft March 30, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants