A self-service analytics platform

Give users a natural language interface to your data — in 3 lines.
app.py
app.py
from shiny.express import render, ui
from querychat.express import QueryChat
from querychat.data import titanic
qc = QueryChat(titanic(), "titanic")
qc.sidebar()
with ui.card():
with ui.card_header():
@render.text
def title():
return qc.title() or "Titanic Dataset"
@render.data_frame
def data_table():
return qc.df()
ui.page_opts(fillable=True, title="Titanic Explorer")| Tool | What it does | User sees |
|---|---|---|
| filter | SELECT * WHERE ... — updates the dashboard |
Data table + title update |
| query | Arbitrary analytics SQL — returns results | SQL + result table in chat |
| visualize | SQL + chart spec — renders inline | Altair chart in chat |
All tools are read-only — no INSERT, UPDATE, or DELETE.
SCREENSHOT: querychat Titanic app showing a conversation —
1. User asks “show me first-class passengers who survived” → dashboard filters
2. User asks “what was the survival rate by class?” → query result table in chat
(capture a real session to show the natural flow)
querychat auto-generates context from your data:
The LLM knows your schema without seeing your data.
Send your CSV to the LLM.
LLM writes SQL. You execute it locally.
The LLM is a translator (language → SQL), not a database.
Best experience — native reactivity. qc.df() drives the whole dashboard.
Same QueryChat API — swap the import, keep your code.
querychat works with data you already have:
import pandas as pd
from sqlalchemy import create_engine
# In-memory DataFrames (pandas, polars, pyarrow)
qc = QueryChat(pd.read_csv("sales.csv"), "sales")
# Databases (via SQLAlchemy)
engine = create_engine("duckdb:///warehouse.duckdb")
qc = QueryChat(engine, "transactions")
# Pins boards (shared data)
qc = QueryChat(board, "monthly_metrics")~15 minutes — work through as many as you can:
Swap the Titanic dataset for your own CSV (or one we provide).
Add a data_description to help the LLM.
Register tool_web_search() so the assistant can answer questions beyond the dataset.
Write a tool that does something the built-in tools can’t — e.g., export to CSV, send a summary email, etc.
Exercise file: exercises/03-querychat-starter.py