pytest-duckdb
SQL pipeline testing made trivial. Load fixture CSVs as tables, run your queries, snapshot the results.
Install
pip install pytest-duckdb
Quick Start
Place CSV files in tests/fixtures/:
tests/
fixtures/
orders.csv
customers.csv
test_queries.py
They become tables automatically:
def test_revenue_query(duckdb_session, sql_snapshot):
result = duckdb_session.execute(
"SELECT * FROM orders WHERE amount > 100"
).fetchall()
# First run saves the snapshot, subsequent runs diff against it
sql_snapshot(result)
Features
- Zero config — fixture CSVs in
tests/fixtures/auto-load as tables - Snapshot testing — first run saves output, subsequent runs diff
- Raw SQL files — test
.sqlfiles directly without dbt - Ephemeral — each test gets a fresh in-memory DuckDB
- Fast — DuckDB is embedded, no Docker, no network
Fixture Loading
CSVs loaded by file stem become table names. orders.csv → orders table.
def test_join(duckdb_session):
result = duckdb_session.execute("""
SELECT c.name, o.amount
FROM orders o JOIN customers c ON o.customer_id = c.id
""").fetchall()
assert len(result) > 0
SQL File Testing
@pytest.mark.sql("queries/revenue_by_month.sql")
def test_revenue_by_month(sql_result, sql_snapshot):
sql_snapshot(sql_result)
Snapshot Update
Regenerate all snapshots when your expected output changes:
pytest --snapshot-update
License
MIT
Metadata
Release files for pytest-duckdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_duckdb-0.1.0.tar.gz | 13.3 kB | With provenance | Details for pytest_duckdb-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_duckdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_duckdb-0.1.0-py3-none-any.whl |
Total release size: 23.1 kB
Release files / pytest_duckdb-0.1.0.tar.gz
| Download URL | pytest_duckdb-0.1.0.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f10ac2c970e03824bc0f20e5f06d06cc039670015ee0e9973e715607443189e
|
|
BLAKE2b-256 checksum How to use checksums |
42bd5acaed74baa58b1f3116c0a485ee51bb23b3cacf708e1256775191edfa4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 10, 2026.
Transparency logRelease files / pytest_duckdb-0.1.0-py3-none-any.whl
| Download URL | pytest_duckdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e798faa7b6b287dbec6c84965b934af176c04851eb6e8467a4ceb288036b0413
|
|
BLAKE2b-256 checksum How to use checksums |
36409a4a5aeb97827e20622d7000844a809d5e16f928f58589e620d77ce789a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 10, 2026.
Transparency logSecurity for pytest-duckdb 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pytest_duckdb-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.