Get Started Free
Live in your browser

DuckDB Playground

Try VisuaLeaf's SQL editor, table data grid, table management and schema designer on DuckDB, right here in your browser. No install, no sign-up, and nothing you type leaves your browser.

Working with MongoDB? Try the MongoDB playground

×

SQL editor

Starting DuckDB in your browser…

Embed

Use these tools outside the playground

The playground is built from web components. A blog post, a SQL course or your product docs can show a live DuckDB editor, table or schema diagram with one script tag. The snippet follows the tool and size you picked above.

  1. Load the script from visualeaf.com

    One script tag from https://visualeaf.com/playground-duckdb/widget/20261121-2249/main.js. We host everything and keep it up to date. Nothing to install or build.

  2. Bring your data

    files lists Parquet, CSV or JSON files by URL so FROM 'sales.parquet' just works. init runs a SQL script first: CREATE TABLE, INSERT, views. The files must allow cross-origin requests (CORS).

  3. Place the element

    Put a <visualeaf-sql>, <visualeaf-table>, <visualeaf-table-manager> or <visualeaf-schema> where it should appear, and size it with CSS like any block. Each reader gets their own in-memory DuckDB.

Your snippet ·

Query files in place

No import step: DuckDB reads Parquet and CSV where they are, nested columns included. name=url gives a file another name.

<visualeaf-sql
  files="https://example.com/sales.parquet
         rates.csv=https://example.com/fx.csv"
  script="FROM 'sales.parquet'
    SELECT region, sum(amount)
    GROUP BY ALL ORDER BY ALL"></visualeaf-sql>

A setup script

init runs SQL once before the reader sees the widget. If a statement fails, the widget shows it with DuckDB's message.

<visualeaf-table table="products"
  init="
    CREATE TABLE products (
      id INTEGER PRIMARY KEY,
      name VARCHAR, price DECIMAL(10, 2));
    INSERT INTO products VALUES
      (1, 'Pen', 2.50), (2, 'Notebook', 7);
  "></visualeaf-table>

One database, many widgets

Widgets with the same shared-db share a database, like on this page. Create a table in the editor, browse it further down.

<visualeaf-sql shared-db="store"
  init-url="https://visualeaf.com/playground-duckdb/widget/20261121-2249/samples/store-init.sql"></visualeaf-sql>

<!-- …the text of your post… -->

<visualeaf-schema shared-db="store"></visualeaf-schema>

Reference

Attributes

Attributes are read when the element starts, so set them before adding it to the page.

AttributeWhat it does
databaseThe database the widget works in: an in-memory DuckDB catalog of that name (default memory, DuckDB's own).
schemaThe schema the screens open on (default main).
filesFiles DuckDB reads by name, as whitespace-separated URLs: files="sales.parquet rates.csv" makes FROM 'sales.parquet' work. name=url registers a file under another name. Fetched once at start.
dataRows to load first, as JSON: {"table": [{…}, …]}, a table per key. DuckDB infers the column types.
data-urlThe same, fetched from a URL.
initA SQL script run once at start, after files and data. A failure stops the widget with the statement and DuckDB's message.
init-urlThe same, fetched from a .sql file.
shared-dbWidgets on the page with the same value share one database. The first to start opens it with its attributes, and what one changes the others see.
nameThe connection's name in the breadcrumb.
themedark or light. Without it: the reader's choice from the ☀ / ☾ toggle, else dark.
resizablefalse hides the handle readers drag to make the widget taller.
min-heightThe smallest height that handle allows, in px (default 360).
viewThe screen to start on (editor, table, manage, schema), when one element should start on another screen.

Like it? Use it on your own databases.

The desktop app has the same SQL editor, table editor, table management and schema designer, plus charts, explain plans, data compare and more, for DuckDB, PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and more.