DuckDB sidekick
A read-only DuckDB, Parquet, delimited-text, and Excel data viewer for Visual
Studio Code.
Open a .duckdb, .parquet, or .parq file normally. For .csv, .tsv,
.tab, .psv, or .xlsx, run PK DuckDB: Query Tabular File with
DuckDB or use Open With > Query Tabular File with DuckDB. The tabular
editor is optional so it does not replace an installed CSV or Excel viewer.
Features
- DuckDB tables appear as workbook-style tabs.
- Parquet files appear as one logical table.
- CSV, TSV, TAB, and PSV files are exposed to SQL as
data.
- Excel sheets appear as workbook-style tabs and keep their sheet names as SQL
relation names.
- Virtualized rows and columns for large datasets.
- Column names and DuckDB logical types remain visible while scrolling.
- Repeating 16-color, color-blind-friendly column palette.
- On-demand Kaggle-style data profiles with key statistics, missing and
approximate unique counts, numeric histograms, and categorical top values.
- Column and row selection, cell copy, Focus Cell, and auto-fit.
- Session SQL editor with Ctrl/Cmd+Enter execution and cancellation, and syntax
highlighting for keywords, types, strings, quoted identifiers, numbers,
function calls, and comments.
- Read-only SQL guard blocks mutating and multi-statement commands.
- Typed query results appear in the same colored grid.
- SQL history remains in memory for the current open-document session.
- Selected history exports to a Python/JupySQL
.ipynb notebook.
- Every exported SQL cell starts with
%%sql followed by a newline.
- Active tables and the active SQL query result can be exported as CSV. A
query result export reruns the query so the file holds every row, not only
the rows shown under the display limit.
- Open files reload after external changes.
Source files are never modified.
Click Data profile in the viewer toolbar to show or hide profiling cards
for the active table. Profiles are calculated lazily by DuckDB and cached for
each sheet until the source file changes. The Query Result tab is also
profileable: its successful SELECT is rerun once to calculate statistics
over the full result rather than only the displayed row limit.
SQL and notebook export
Click SQL in the viewer toolbar, enter one read-only query, and select
Run or press Ctrl/Cmd+Enter.
The viewer accepts result-producing statements such as SELECT and EXPLAIN.
Statements such as INSERT, UPDATE, DELETE, CREATE, COPY, ATTACH,
INSTALL, and LOAD are blocked.
The History panel records each command, status, duration, and displayed row
count until the document closes. Export Notebook creates a JupySQL notebook
that reconnects to the opened DuckDB database in read-only mode. Parquet
exports create an in-memory DuckDB connection and register the file as a view.
Delimited and Excel exports recreate the same source relations and parsing
options.
Tabular source loading
The viewer uses a scan-then-materialize strategy:
- Auto materializes delimited files up to 128 MB in memory, uses a temporary
on-disk DuckDB cache for larger files, and uses disk for Excel.
- Memory and Disk force materialization to the selected session store.
- Direct leaves relations as file scans, which opens quickly but rescans the
source for repeated queries and profiles.
The cache lives in the operating system temporary directory and is removed
when the viewer worker closes. Excel sheets are registered immediately and
materialized individually when first browsed, profiled, or exported. SQL can
query any registered sheet before materialization.
Use Source settings in the viewer toolbar to change storage, delimiter,
header, encoding, type inference, malformed-row handling, or Excel empty-row
behavior for the current open session. Workspace defaults are available under
pkDuckDb.tabular* settings. TSV/TAB defaults to tab, PSV defaults to pipe,
and Excel treats the first row as a header unless No header row is selected.
Commands
- PK DuckDB: Toggle SQL Editor
- PK DuckDB: Run SQL
- PK DuckDB: Cancel SQL
- PK DuckDB: Show SQL History
- PK DuckDB: Export SQL History as Jupyter Notebook
- PK DuckDB: Clear SQL History
- PK DuckDB: Export Active Table or Query Result as CSV
- PK DuckDB: Auto-fit All Columns
- PK DuckDB: Query Tabular File with DuckDB
- PK DuckDB: Configure Tabular Source
Contributing
Building the extension from source, running tests, and packaging a release are
covered in DEV.md.
License
MIT