Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

duckdb

БесплатноБез исполняемых скриптовНе проверен

DuckDB is an in-process analytical database that runs embedded inside your application with zero external dependencies. It can query CSV, Parquet, and JSON…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

DuckDB

Overview

DuckDB is an embeddable SQL OLAP database. Think of it as SQLite for analytics — it runs in your process, needs no server, and is optimized for scanning and aggregating large datasets. It reads Parquet, CSV, and JSON files natively, which means you can query your data lake files with SQL without any import step.

This skill covers the CLI for ad-hoc exploration, the Python API for data science workflows, the Node.js API for application integration, and Parquet as the preferred storage format.

Instructions

Pick the client that fits the job: the CLI for exploration, Python or Node for pipelines. All of them run the same SQL.

CLI

Install DuckDB as a standalone binary. On macOS and Linux, a single download gives you a full-featured SQL shell.

# install — DuckDB CLI via Homebrew (macOS/Linux)
brew install duckdb
# install — DuckDB CLI via direct download (Linux x64, v2.0.0 ships .tar.gz)
curl -fsSL -o duckdb-cli.tar.gz https://github.com/duckdb/duckdb/releases/download/v2.0.0/duckdb-cli-linux-amd64.tar.gz
# compare with the sha256 shown for this asset on the v2.0.0 release page before extracting
sha256sum duckdb-cli.tar.gz
tar xzf duckdb-cli.tar.gz
./duckdb --version

The old releases/latest/download/duckdb_cli-linux-amd64.zip URL returns 404 for 2.0 (the archive is now duckdb-cli-<os>-<arch>.tar.gz), so pin the version. pip install duckdb and npm install @duckdb/node-api need no CLI at all.

Launch the shell and start querying files directly:

# CLI — query a CSV file without creating a table
duckdb -c "SELECT country, count(*) AS orders
            FROM 'orders.csv'
            GROUP BY country
            ORDER BY orders DESC
            LIMIT 10"

The CLI can also persist data to a file-based database:

# CLI — create a persistent database and import data
duckdb analytics.db <<'SQL'
CREATE TABLE events AS SELECT * FROM 'raw_events.parquet';
SELECT event_name, count(*) FROM events GROUP BY event_name;
SQL

Querying Files Directly

DuckDB's most powerful feature is its ability to query files in place. No CREATE TABLE, no COPY, no ETL — just point SQL at a file path or glob pattern.

-- query — scan all Parquet files in a directory
SELECT
    date_trunc('month', created_at) AS month,
    count(*) AS events
FROM 'data/events/*.parquet'
GROUP BY month
ORDER BY month;
-- query — join a CSV with a Parquet file
SELECT
    u.email,
    count(e.event_id) AS event_count
FROM 'users.csv' u
JOIN 'events.parquet' e ON u.id = e.user_id
GROUP BY u.email
ORDER BY event_count DESC
LIMIT 20;
-- query — read JSON lines (newline-delimited JSON)
SELECT * FROM read_json_auto('logs.jsonl') LIMIT 5;

Python API

DuckDB's Python package integrates tightly with pandas and the broader PyData ecosystem. Install it with pip and start querying DataFrames with SQL.

# duckdb_analysis.py — Python API for analytical queries
# pip install duckdb pandas

import duckdb
import pandas as pd

# DuckDB can query pandas DataFrames directly
df = pd.DataFrame({
    'user_id': [1, 2, 3, 1, 2, 1],
    'event': ['view', 'view', 'signup', 'click', 'click', 'view'],
    'ts': pd.date_range('2025-01-01', periods=6, freq='h')
})

# Query the DataFrame with SQL — no import needed
result = duckdb.sql("""
    SELECT event, count(*) AS total, count(DISTINCT user_id) AS users
    FROM df
    GROUP BY event
    ORDER BY total DESC
""").fetchdf()

print(result)

For persistent databases with the Python API:

# duckdb_persistent.py — persistent database with Python
# pip install duckdb

import duckdb

# Open or create a database file
con = duckdb.connect('analytics.db')

# Create a table from a Parquet file
con.execute("""
    CREATE TABLE IF NOT EXISTS events AS
    SELECT * FROM 'raw_events.parquet'
""")

# Run aggregation
daily_stats = con.execute("""
    SELECT
        date_trunc('day', created_at) AS day,
        count(DISTINCT user_id) AS dau,
        count(*) AS total_events
    FROM events
    WHERE created_at >= current_date - INTERVAL '30 days'
    GROUP BY day
    ORDER BY day
""").fetchdf()

print(daily_stats)
con.close()

Node.js API

Use @duckdb/node-api (the "Neo" client, promise-based, current line 2.0). The older duckdb npm package is deprecated and stops at 1.4.x, and duckdb-async is only a wrapper around it.

// duckdb-query.mjs — Node.js DuckDB client for analytical queries
// npm install @duckdb/node-api

import { DuckDBInstance } from '@duckdb/node-api';

const instance = await DuckDBInstance.create(':memory:');
const conn = await instance.connect();

await conn.run(`CREATE TABLE events AS SELECT * FROM 'events.parquet'`);

const reader = await conn.runAndReadAll(`
  SELECT event_name, count(*) AS total, count(DISTINCT user_id) AS unique_users
  FROM events
  GROUP BY event_name
  ORDER BY total DESC
`);

// BIGINT columns come back as JS bigint; getRowObjectsJson(
Полный SKILL.md на GitHub

Установить duckdb в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл duckdb?

DuckDB is an in-process analytical database that runs embedded inside your application with zero external dependencies. It can query CSV, Parquet, and JSON files directly without loading them into tables first, making it ideal for local data exploration, ETL pipelines, and analytical workloads where spinning up a server is overkill.

Как установить скилл duckdb?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл duckdb запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить duckdb с