duckdb-pythonlisted
Install: claude install-skill srimon12/duckdb-2-skills
# Python client on DuckDB 2.0
DuckDB 2.0 requires Python 3.11 or newer and does not support free-threaded CPython (PEP 703). On Python 3.10 or earlier, `pip install duckdb` installs legacy 1.x releases.
```bash
pip install duckdb==2.0.0
python -c "import duckdb; print(duckdb.__version__)"
```
For database file storage migration, consult `duckdb-migrate`. For SQL syntax and dialect behaviors, see `duckdb-sql`.
## Connect and concurrency
```python
import duckdb
duckdb.sql("SELECT 42").show() # Module default in-memory database; returns lazy relation
con = duckdb.connect("app.duckdb") # Persistent database file
con = duckdb.connect("app.duckdb", read_only=True)
con = duckdb.connect(config={"threads": 4, "memory_limit": "2GB"})
```
When issuing queries without an explicit connection handle, `duckdb.sql()` and `duckdb.execute()` operate on a shared module-level in-memory database. For isolated transactions, persistent files, or specific engine configurations, obtain an explicit connection with `duckdb.connect()`.
When dispatching work across threads, never share a single connection handle. The option `check_same_thread` was removed in 2.0 and raises `TypeError`. Allocate an independent cursor to each thread via `con.cursor()`. Each cursor isolates its own transaction state and connection-local settings (such as `search_path`), while sharing database-global configurations. Closing a parent connection terminates all its descendant cursors.
When executing Pytho