AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Duckdb Python 1 5 4

skill-tangledgroup-tangled-skills-duckdb-python-1-5-4 · by tangledgroup

DuckDB Python client 1.5.4 API reference and usage patterns. Use when working with the `duckdb` Python package — in-process analytical SQL database. Covers connection management, relational API (lazy evaluation), data I/O (CSV/Parquet/JSON), Python UDFs, type system, pandas/PyArrow/Polars integration, fsspec filesystems, ADBC driver, profiling, and extensions. Trigger on: duckdb, DuckDBPyConnecti…

No reviews yet
0 installs
33 views
0.0% view→install

Install

$ agentstack add skill-tangledgroup-tangled-skills-duckdb-python-1-5-4

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-tangledgroup-tangled-skills-duckdb-python-1-5-4)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
Archived

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Duckdb Python 1 5 4? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

duckdb-python 1.5.4

DuckDB Python client providing in-process analytical SQL database with zero-config deployment. Runs entirely in-process (no server), supports pandas, PyArrow, Polars, and NumPy natively.

Overview

DuckDB is a columnar OLAP engine that runs inside the Python process. Two main API styles:

  • Connection/DB-API 2.0duckdb.connect(), conn.execute(), fetchall() — standard cursor interface
  • Relational APIduckdb.sql(), .filter(), .project(), .join() — lazy, chainable, returns DuckDBPyRelation

Key strengths:

  • Reads CSV/Parquet/JSON directly from paths or buffers without loading into memory first
  • Seamless pandas DataFrame and PyArrow Table interop via from_df(), fetchdf(), to_arrow_table()
  • Python scalar UDFs registered with create_function() (native or arrow-backed)
  • fsspec filesystem integration for S3, GCS, Azure, and in-memory storage
  • ADBC driver included (adbc_driver_duckdb)

Usage

Quick start — top-level convenience functions

import duckdb

# Query returns DuckDBPyRelation (lazy)
rel = duckdb.sql("SELECT 42 as x, 'hello' as y")
rel.show()

# Read files directly
rel = duckdb.read_parquet("data/*.parquet")
rel = duckdb.read_csv("data.csv", header=True)
rel = duckdb.read_json("data.json")

# Convert to pandas / PyArrow
df = rel.df()                          # pandas DataFrame
table = rel.to_arrow_table()           # pyarrow.Table
reader = rel.to_arrow_reader()         # streaming RecordBatchReader

Connection-based workflow

import duckdb

conn = duckdb.connect("my_db.duckdb")  # persistent; ":memory:" is default

# Register a pandas DataFrame as a virtual table
conn.register("sales", sales_df)

# Execute SQL, get Relation back
rel = conn.sql("SELECT region, SUM(amount) FROM sales GROUP BY region")
rel.show()

# Standard DB-API 2.0 cursor interface
cursor = conn.cursor()
cursor.execute("SELECT * FROM sales WHERE amount > ?", [1000])
rows = cursor.fetchall()

conn.close()

Relational API chaining (lazy evaluation)

rel = (duckdb.from_df(df)
       .filter("amount > 100")
       .project("region, customer_id, amount * 1.1 as taxed_amount")
       .order("taxed_amount DESC")
       .limit(10))

rel.show()

Python UDFs

import duckdb

def double_it(x):
    return x * 2

duckdb.create_function("double_it", double_it, ["integer"], "integer")
duckdb.sql("SELECT double_it(i) FROM range(5)").show()

Gotchas

  • Default connection is :memory: — data disappears when the process exits. Pass a file path to connect() for persistence.
  • fetch_arrow_table() and fetch_record_batch() are deprecated — use to_arrow_table() and to_arrow_reader() instead (same on both Connection and Relation).
  • Relations are lazy.filter(), .project(), .join() etc. build a query plan. Results materialize only on .show(), .fetchall(), .df(), .execute(), or .create().
  • conn.register() creates a virtual table reference — it holds a Python object alive as long as the view/table exists in DuckDB catalog. Unregister with conn.unregister("name") to release.
  • UDF parameter types must match exactlycreate_function("fn", fn_impl, ["bigint"], "varchar") requires input columns to be castable to BIGINT. Mismatched types raise InvalidInputException.
  • Arrow UDFs receive ChunkedArrays — use @duckdb.udf.vectorized decorator or annotate parameters with pa.ChunkedArray for arrow-mode UDFs.
  • conn.pl() returns Polars DataFrame — requires polars installed. Use lazy=True for LazyFrame.
  • Free-threaded Python (3.13t, 3.14t) is not supported — the production client does not work with free-threaded builds.
  • conn.duplicate() clones a connection sharing the same database but with independent transaction state. Useful for concurrent queries on the same DB.

References

  • [01-connection-api](references/01-connection-api.md) — connect, execute, cursor, transactions, config
  • [02-relational-api](references/02-relational-api.md) — DuckDBPyRelation: lazy chaining, joins, aggregations, exports
  • [03-data-io](references/03-data-io.md) — CSV, Parquet, JSON read/write with options
  • [04-udfs](references/04-udfs.md) — Python scalar UDFs (native and arrow), type annotations, null handling
  • [05-types-values](references/05-types-values.md) — DuckDBPyType, sqltypes constants, Value classes, DB-API type objects
  • [06-integrations](references/06-integrations.md) — pandas, PyArrow, Polars, NumPy, fsspec, ADBC, Spark compat

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.