Skip to content

DuckDB Extension

Shellfs

Read shell-command output as a file in DuckDB, or pipe query results into another program. Use Unix pipelines with read_csv, read_json, and COPY.

498,689
extension loads · last 90 days
On this page

Use a command’s output as a SQL data source

Shellfs connects DuckDB’s file readers and writers to Unix processes. A command can produce the bytes that a reader consumes, or receive the output written by DuckDB.

Use it with an existing command-line tool for fetching, decompressing, or transforming data. The pipe carries bytes, so its format still needs to match the DuckDB reader or writer. Commands run on the machine hosting DuckDB, which makes this a native-client workflow.

Example

Read CSV from a shell command

The printf command emits a header and two rows. A trailing pipe tells Shellfs to read the command’s standard output.

Before you run it: Use a supported native build with a Unix shell and printf available.

Tested with DuckDB 1.5.6. Run this example in the DuckDB CLI or a native client.

SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
  WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL shellfs FROM query_farm;
LOAD shellfs FROM query_farm;

SELECT *
FROM read_csv('printf "name,score\nMina,8\nTheo,9\n" |', header = true);

Expected result

name score
Mina 8
Theo 9

Shellfs executes the command in the DuckDB process’s environment. Only use commands you intend to run, and do not build shell strings from untrusted row values.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Configuration
ignore_sigpipe Object type: Setting Treat a pipe closed early by either side (EPIPE / SIGPIPE) as success instead of an error
shellfs_enabled Object type: Setting Allow shellfs to run shell commands ('command |' and '| command').

Configuration

Settings

Configure the shellfs extension behavior using these settings.

ignore_sigpipe

Default Value: false

shellfs_enabled

Default Value: true

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Stable
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
498,689
loads · last 90 days

Platforms

DuckDB 2.0.0

  • Linux x86_64aarch64
  • Linux (musl) Not available
  • macOS Apple Silicon
  • Windows x86_64x86_64 (MinGW)
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 3.96 MB
Linux aarch64 3.32 MB
macOS Apple Silicon 2.81 MB
Windows x86_64 10.20 MB
Windows x86_64 (MinGW) 17.79 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • DuckDB v2.0.0 Query.Farm repository Supported
  • Haybarn v1.5.6 Built-in community repository Supported

Browser examples use Haybarn-Wasm 2.0.0-rc12.

Checked .

Learn and explore

Tutorials and articles

Writing about Shellfs: how it works, what changed, and why.