Skip to content

ExamplesΒΆ

Serve the repository root with any static server, for instance:

python3 -m http.server 8000
Example URL What it shows
01-duckdb-wasm-standalone http://localhost:8000/examples/01-duckdb-wasm-standalone/ 100 % static page. <source-table> loads a local CSV into DuckDB-WASM; score cards, bar / line / pie charts, <data-table measures="...">, date and dimension filters, cross-filtering with click and Ctrl / Cmd + click.
02-iframe-semantic-playground http://localhost:8000/examples/02-iframe-semantic-playground/host.html A Host application and a sandboxed iframe in semantic mode. Presets of generated dashboards (including custom ECharts charts and a hostile page), light / dark switch without reload, user profiles with row-level security, ALLOW_TABLE_MODE toggle, live postMessage console showing score card batching.
03-iframe-duckdb-host-worker http://localhost:8000/examples/03-iframe-duckdb-host-worker/host.html The iframe stays sandboxed with no network and uses table="..."; DuckDB-WASM runs in the Host, which validates each QuerySpec, compiles it to SQL and shows the executed SQL.

Files of example 02:

  • host.html, host.js: the Host (controls, HostBridge, security rules).
  • presets.js: the dashboards given to the iframe.
  • mock_semantic_backend.js: JavaScript simulation of the Python measures engine (query(metrics, date_range, dimensions, ...)) on 50 optical stores over 24 months.
  • python_semantic_reference.py: the Pydantic / Python handler to plug in FastAPI or Streamlit. It contains a self-test:
python3 examples/02-iframe-semantic-playground/python_semantic_reference.py

data/orders.csv is generated by node examples/data/generate_orders.mjs.

The examples load ECharts and DuckDB-WASM from the jsDelivr CDN, so the browser needs internet access.