The Problem: Data Visualization is a Pain
You’ve got your data neatly organized in DuckDB. Your boss wants a dashboard — yesterday.
Your options:
- Metabase → Free but heavy. Need a separate server, Java runtime, lots of config.
- Python + Plotly → 200+ lines of code for what should be a 5-line query.
- Excel charts → 1990 called, they want their workflow back.
What if you could just write SQL and get a chart?
Shaper is exactly that — an open-source, SQL-driven dashboard tool powered by DuckDB under the hood. Write SQL queries with type annotations, and Shaper renders them as bar charts, line charts, pie charts, tables, and more.
GitHub: https://github.com/taleshape-com/shaper (1.1k ⭐, actively maintained)
What is Shaper?
Shaper’s positioning is crystal clear: the DuckDB visualization layer for SQL users.
“As Official says: All in SQL, Powered by DuckDB.”
The core idea: You don’t need to learn any new API or DSL. Just append ::BARCHART, ::XAXIS, etc. to your SQL columns and Shaper figures out how to visualize them.
-- Shaper SQL example
SELECT
date_trunc('week', created_at)::XAXIS,
category::CATEGORY,
count()::BARCHART_STACKED
FROM dataset
GROUP BY ALL ORDER BY ALL;
This SQL produces a stacked bar chart — no JavaScript, no JSON config, no drag-and-drop.
Key Features
| Capability | Description |
|---|---|
| Fully Open Source | MPL-2.0 license, self-hosted |
| SQL-First | Define charts via SQL type annotations |
| Git Workflow | Version-control your dashboards |
| Multi-Source | Query across DuckDB, CSV, Parquet, MySQL, Postgres |
| White-Label Embed | Embed in iframe or via JS/React SDK without branding |
| Export | PDF, PNG, CSV, Excel with one click |
| Scheduled Reports | Auto-generate and deliver reports |
| Row-Level Security | JWT tokens for data access control |
10-Minute Quickstart
Minute 1: Start Shaper
The fastest way to try Shaper is via Docker:
docker run --rm -it -p5454:5454 taleshape/shaper
Open http://localhost:5454 — you’ll see a clean dashboard editor.
No Docker? Shaper also ships as npm and pip packages:
npm install @taleshape/shaperpip install shaper
Minutes 2-5: Import Data + First Query
Click “New Query” and write your first SQL:
-- See what we're working with
SELECT * FROM read_csv_auto('sales_2024.csv') LIMIT 10;
Shaper uses DuckDB’s engine natively, so all DuckDB features work — read_csv_auto, read_parquet, ATTACH for MySQL/PostgreSQL…
Now for a real chart:
SELECT
strftime(order_date, '%Y-%m')::XAXIS,
product_category::CATEGORY,
SUM(amount)::BARCHART_STACKED
FROM read_csv_auto('sales_2024.csv')
GROUP BY ALL ORDER BY ALL;
Minutes 6-10: Assemble Your Dashboard
Add more queries to build a complete dashboard:
KPI Card:
SELECT
'Total Revenue'::LABEL,
'$' || FORMAT('%,.0f', SUM(amount))::VALUE,
'vs last month ' || CASE WHEN SUM(amount) - LAG(SUM(amount)) OVER () > 0 THEN '↑' ELSE '↓' END || FORMAT('%.1f%%', ABS((SUM(amount) - LAG(SUM(amount)) OVER ()) / LAG(SUM(amount)) OVER () * 100))::SUBTITLE
FROM read_csv_auto('sales_2024.csv');
Trend Line:
SELECT
order_date::XAXIS,
SUM(amount)::LINE
FROM read_csv_auto('sales_2024.csv')
GROUP BY ALL ORDER BY ALL;
Top 10 Products:
SELECT
product_name::LABEL,
SUM(amount)::BARCHART
FROM read_csv_auto('sales_2024.csv')
GROUP BY ALL ORDER BY SUM(amount) DESC LIMIT 10;
Ten minutes. A 4-component professional dashboard. All SQL. No frontend code.
Advanced Features
4.1 KPI Monitoring & Alerts
Shaper supports scheduled scans that trigger alerts when metrics cross thresholds:
-- Alert if today's sales < $10,000
SELECT
SUM(amount)::VALUE,
CASE WHEN SUM(amount) < 10000 THEN '🚨 Below Target'
ELSE '✅ On Track' END::STATUS
FROM read_csv_auto('sales_2024.csv')
WHERE order_date = CURRENT_DATE;
4.2 Embedded Dashboards
Want to embed dashboards in your product? Shaper supports:
- iframe embedding: One line of HTML
- JS/React SDK: Full control over styling, no iframe needed
- White-label mode: Hide Shaper branding
<!-- iframe embed -->
<iframe src="https://your-shaper.com/d/sales-dashboard"
width="100%" height="600px"
frameborder="0"></iframe>
// React SDK approach
import { ShaperDashboard } from '@taleshape/shaper-react';
function App() {
return <ShaperDashboard dashboardId="sales-dashboard"
token="your-jwt-token" />;
}
4.3 Scheduled PDF Reports
Configure a cron job to generate PDF reports on schedule:
# Export via CLI
curl -X POST https://your-shaper.com/api/dashboards/sales-weekly/export \
-H "Authorization: Bearer your-token" \
-d '{"format": "pdf"}'
When Should You Use Shaper?
Best for:
- Teams already using DuckDB for data analysis
- SQL analysts who need quick charts
- Developers building client-facing dashboards
- Backend engineers who want to avoid JavaScript
Not ideal for:
- Complex interactive dashboards with drill-down animations
- Non-technical users who need drag-and-drop (Shaper is SQL-driven)
Bottom line: If you already use DuckDB, Shaper is the shortest path from query to dashboard to share.
Summary
Shaper fills the missing visualization layer in the DuckDB ecosystem. It bridges the gap between “querying data with SQL” and “seeing charts that drive decisions” — no new tools, no frontend code, just the SQL you already know.
10 minutes. Zero to a professional dashboard. That’s Shaper’s promise.
Get started now:
docker run --rm -it -p5454:5454 taleshape/shaper
Open http://localhost:5454 and give it a try.
本文信息
| 项目 | 内容 |
|---|---|
| DuckDB 版本 | v1.5.x(部分功能基于 v2.0 Preview) |
| 最后验证 | 2026-09-12 |
| 测试环境 | Linux / x86_64 / 16GB RAM |
| 官方文档 | DuckDB Documentation |
| GitHub | pengzz9527/duckdb-blog |
如发现错误,欢迎通过 GitHub Issue 或邮件 contact@duckdblab.org 反馈。
