SQL playground

Run SQL against the latest Cancer Basemap release in your browser with DuckDB-Wasm. Nothing to install.

Edit the query and press Run. It runs in your browser with DuckDB-Wasm, against latest/ attached as basemap (and selected with USE basemap, so measure.observation works as well as basemap.measure.observation). The first run downloads DuckDB itself, a few MB.

Queries that filter and use LIMIT are fast, because DuckDB fetches only the parts of each Parquet file it needs. Full scans of the big tables (measure.observation has tens of millions of rows) are slow and can run out of browser memory. For those, use DuckDB on your own machine (Versions and citation).

Queries to try

Copy one into the box, or open it in the DuckDB Shell.

-- Every table in the database
SELECT schema_name, view_name
FROM duckdb_views()
WHERE database_name = 'basemap' AND NOT internal
ORDER BY 1, 2;
-- A cell the source did not report never reads as a number
SELECT value_status, count(*) AS n, count(value) AS with_value
FROM measure.observation
GROUP BY value_status
ORDER BY n DESC;
-- The provenance of this release
SELECT release, published_at, git_sha
FROM read_json('https://basemap.cancerdatasci.org/data/latest/manifest.json');
-- What each release was built from: one row per release, one column per
-- source, each cell that source's own version string
PIVOT provenance.release
ON source
USING first(source_version)
GROUP BY release
ORDER BY release;