A DuckDB appender for Python
Project description
DuckDB PyAppender
A DuckDB appender for Python.
Installation
Usage
import duckdb
from duckdb_appender import Appender
conn = duckdb.connect()
appender = Appender(conn, schema="main", table="users")
appender.append_row([1, "John"])
appender.append_row([2, "Doe"])
appender.close()
# Can also use it with context manager:
with Appender(conn, schema="main", table="users") as appender:
appender.append_row([3, "foo"])
See more in the /examples folder.
Why use this
- Much faster than simple INSERT statements.
- Versus storing data in a pandas DataFrame and load into DuckDB: while pandas loads the entire dataset into memory, this appender uses SQLite as a buffer that regularly flush itself (every 204,800 rows, similar to the official C++ appender)
- This prevents memory overload on large data aggregation.
- A little bit of crash protection - since it commits data every 204,800 rows, you'll preserve most of your progress if something goes wrong.
Local development
This repo uses uv to manage dependencies and
virtual environment. Dependencies are written in pyproject.toml, so other
tools supporting it can be used as well.
Run test
This repo use pytest. To run tests within an uv environment, run:
uv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file duckdb_appender-0.3.1.tar.gz.
File metadata
- Download URL: duckdb_appender-0.3.1.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d8c19876d3f44124addf91bbf49f33ef0f2cf6d8414c3845e61f8791f8f21a0
|
|
| MD5 |
c58acebac4464eb5ed353aed8c35e5be
|
|
| BLAKE2b-256 |
6cbb8748226361a22b888e8ca6bc2bc7a846a5980f6c75d05b7f9925f78b4d1c
|
Provenance
The following attestation bundles were made for duckdb_appender-0.3.1.tar.gz:
Publisher:
publish.yaml on toanphan19/duckdb-appender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
duckdb_appender-0.3.1.tar.gz -
Subject digest:
3d8c19876d3f44124addf91bbf49f33ef0f2cf6d8414c3845e61f8791f8f21a0 - Sigstore transparency entry: 150128225
- Sigstore integration time:
-
Permalink:
toanphan19/duckdb-appender@0a211e6ebb1c58e9add8fdc80e43917bfcab11bf -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/toanphan19
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0a211e6ebb1c58e9add8fdc80e43917bfcab11bf -
Trigger Event:
release
-
Statement type:
File details
Details for the file duckdb_appender-0.3.1-py3-none-any.whl.
File metadata
- Download URL: duckdb_appender-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a390ff7a242d801efbe1ac8230525ea7f21a587ea2c2ff550467c54421eeeb
|
|
| MD5 |
8d630328d663648e9ad486b61847899f
|
|
| BLAKE2b-256 |
49ac0cd4a62d31ca3b3b3ad8009f6409dc6f8414a5c8faeeb954f0a25eb854f0
|
Provenance
The following attestation bundles were made for duckdb_appender-0.3.1-py3-none-any.whl:
Publisher:
publish.yaml on toanphan19/duckdb-appender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
duckdb_appender-0.3.1-py3-none-any.whl -
Subject digest:
56a390ff7a242d801efbe1ac8230525ea7f21a587ea2c2ff550467c54421eeeb - Sigstore transparency entry: 150128226
- Sigstore integration time:
-
Permalink:
toanphan19/duckdb-appender@0a211e6ebb1c58e9add8fdc80e43917bfcab11bf -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/toanphan19
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0a211e6ebb1c58e9add8fdc80e43917bfcab11bf -
Trigger Event:
release
-
Statement type: