| name | duckdb-python-1-5-4 |
| description | 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, DuckDBPyConnection, DuckDBPyRelation, read_parquet, from_df, create_function, fetch_arrow_table, register_filesystem. |
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.0 —
duckdb.connect(), conn.execute(), fetchall() — standard cursor interface
- Relational API —
duckdb.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
duckdb
rel = duckdb.sql()
rel.show()
rel = duckdb.read_parquet()
rel = duckdb.read_csv(, header=)
rel = duckdb.read_json()
df = rel.df()
table = rel.to_arrow_table()
reader = rel.to_arrow_reader()