duckdb

The official Python client for DuckDB, an in-process analytical SQL database

SDK
PyPI
v1.5.5
189 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
82 /100 Excellent
Development Activity 100
Maintenance 96
Community 56
Maturity 36
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
84 /100 Excellent
Architecture 88
Code Quality 85
Innovation 85
Learning Curve 78

duckdb is the official Python package for DuckDB, a fast, in-process, columnar analytical database engine. It wraps DuckDB’s C++ core (vendored in this repo alongside the Python bindings) in a DB-API 2.0-compatible connection interface, while adding Python-specific ergonomics: zero-copy result fetching into Pandas, NumPy, Arrow, and Polars, a fluent Relation API for building queries programmatically, scalar/table Python UDFs, and a duckdb.experimental.spark compatibility layer for porting PySpark code.

As of mid-2025 this bindings/build repo was split out from the main duckdb/duckdb monorepo into its own dedicated repository so the Python client could iterate and release independently of the core engine, while still vendoring the C++ source needed to build the extension module. It remains the canonical source for the duckdb PyPI package and is actively maintained by the DuckDB Foundation.

What You Get

  • An embedded, in-process analytical SQL engine with no server to install or manage — import duckdb is enough to run SQL
  • Zero-copy or near-zero-copy interchange with Pandas, NumPy, PyArrow, and Polars dataframes for both querying and result fetching
  • A fluent Relation API (duckdb.sql(...), .filter(), .aggregate(), .df()) for building queries programmatically instead of string concatenation
  • Native readers/writers for Parquet, CSV, and JSON, including remote reads from S3 and other object stores via the httpfs/fsspec filesystem layer
  • Python scalar and table user-defined functions (UDFs) callable directly from SQL
  • A duckdb.experimental.spark compatibility layer that mimics PySpark’s DataFrame API on top of DuckDB’s engine
  • An adbc_driver_duckdb package for Arrow Database Connectivity (ADBC) integration

Common Use Cases

  • Running fast, local analytical SQL queries directly over Pandas/Polars dataframes or Parquet/CSV files without spinning up a database server
  • Replacing ad-hoc Pandas transformation code with SQL for large or complex aggregations that benefit from a columnar, vectorized engine
  • Querying data lakes (Parquet/CSV/JSON on S3 or local disk) as an embedded analytics layer inside a Python data pipeline or notebook
  • Prototyping or migrating PySpark-style code locally via the duckdb.experimental.spark compatibility layer before deploying to a full Spark cluster

Under The Hood

Architecture - the repo pairs a Python package (duckdb/) with a C++ extension (src/pyconnection, src/pyrelation, src/pyresult, src/pyexpression) that bridges DuckDB’s core engine to Python objects; pyconnection.cpp implements the DB-API-style Connection, pyrelation.cpp implements the lazy, chainable Relation query-builder, and dedicated arrow/, pandas/, and numpy/ subdirectories under src/ implement the zero-copy conversion paths for each dataframe library. The pure-Python layer (duckdb/experimental/spark, duckdb/func, duckdb/udf.py) builds higher-level compatibility and UDF support on top of the C++ core rather than reimplementing engine logic. Tech Stack - built with scikit-build-core and CMake to compile the vendored C++ DuckDB engine into a Python extension module, targeting Python 3.11+ with optional dependencies (pandas, pyarrow, numpy, fsspec, ipython, adbc-driver-manager) gated behind the duckdb[all] extra so the core install stays dependency-free. Code Quality - the tests/ directory is split into fast/ and slow/ suites plus dedicated extensions/, coverage/, and spark_namespace/ subdirectories, indicating a deliberately tiered CI strategy; a .pre-commit-config.yaml and CLAUDE.md (repo-specific AI-agent guidance) point to an actively enforced contribution workflow with linting and formatting gates. API Design - the package layers three access patterns of increasing abstraction: raw DB-API execute()/fetchall() for SQL-first users, duckdb.sql() returning a chainable Relation for a query-builder style, and direct .df()/.arrow()/.pl() result methods for immediate dataframe interop — letting a new user run a query in one line while still exposing the lower-level connection object for advanced use.

Used by 14 apps in this directory

Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 4 days ago
Python
47%
Other

Airbyte

Data Engineering · Developer Tools

22,143

Open-source ELT platform with 600+ connectors for moving data from any source to warehouses, lakes, and AI agents.

View details
95
Repo Health
80
Technical
67
Dependency
Built with
Python 47%
Kotlin 43%
Updated 4 days ago
Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
Python
92%
Apache 2.0

ART

AI Development

10,779

Give your LLM agents on-the-job training—ART lets you apply GRPO reinforcement learning to any multi-step agentic workflow with minimal code changes.

View details
85
Repo Health
82
Technical
73
Dependency
Built with
Python 92%
Updated 5 days ago
TypeScript
84%
Apache 2.0

ktx

AI Development · Analytics · Data Engineering

1,603

ktx builds a self-improving context layer over your data warehouse so AI agents like Claude Code and Codex query it with approved metric definitions instead of reinventing SQL logic from scratch.

View details
66
Repo Health
85
Technical
72
Dependency
Built with
TypeScript 84%
Updated 3 weeks ago
Rust
43%
Apache 2.0

LanceDB

AI Development · Databases

11,544

Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).

View details
90
Repo Health
86
Technical
71
Dependency
Built with
Rust 43%
Python 25%
HTML 23%
Updated 5 days ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
62%
Apache 2.0

marimo

Data Engineering · Developer Tools

22,918

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
89
Repo Health
91
Technical
65
Dependency
Built with
Python 62%
TypeScript 37%
Updated 5 days ago
C++
66%
Other

Memgraph

AI Development · Databases

4,581

High-performance in-memory graph database for AI context and real-time analytics

View details
90
Repo Health
79
Technical
69
Dependency
Built with
C++ 66%
Python 18%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers