thunderduck-airflow
An Apache Airflow provider for Thunderduck: submit SQL to the REST API, wait for the stored result, cancel cleanly, and hand the execution id on to the next task.
pip install thunderduck-airflow
Requires Apache Airflow 3.0+ and Python 3.11+. Airflow 2 reached end of life on 2026-04-22; this provider does not carry the compatibility shims for it.
The connection
Create an Airflow connection of type Thunderduck (or via the CLI/env):
| Field | Value |
|---|---|
| Conn Id | thunderduck_default (or your own) |
| Host | api.thunderduck.ai — https:// is optional |
| Password | your Thunderduck API token |
| Extra | optional JSON, see below |
airflow connections add thunderduck_default \
--conn-type thunderduck \
--conn-host api.thunderduck.ai \
--conn-password "$THUNDERDUCK_TOKEN"
Extras:
{
"endpoint": "https://api.thunderduck.ai",
"timeout": 3600,
"poll_interval": 2,
"token": "tdk_..."
}
endpoint wins over host/port, timeout is how long to wait for a run
(seconds, default 3600), poll_interval is the delay between status checks
(default 2), and token is an alternative to the password field. The Test
connection button performs one authenticated GET /catalog/schema.
Running a query
from thunderduck_airflow.operators.query import ThunderduckQueryOperator
preview = ThunderduckQueryOperator(
task_id="preview",
sql="""
SELECT region, sum(total) AS revenue
FROM sales_pg.public.orders
GROUP BY region
ORDER BY revenue DESC
""",
fetch_rows=50,
)
The task returns, and pushes to XCom:
{"execution_id": "…", "row_count": 12, "columns": ["region", "revenue"], "rows": [...]}
columns/rows are only present when fetch_rows is set. XCom lives in the
metadata database, so keep it small: for a real hand-off use the execution id
and fetch the Parquet export instead.
sql is templated, and a value ending in .sql is loaded from the DAG folder:
ThunderduckQueryOperator(task_id="daily", sql="sql/daily_revenue.sql")
A failed, errored or timed-out run fails the task. The operator asks Thunderduck
to cancel the run first, so a retry does not leave the previous execution
burning compute; on_kill does the same when the task is cleared or killed.
Deferring to the triggerer
from thunderduck_airflow.operators.query_async import ThunderduckQueryAsyncOperator
rollup = ThunderduckQueryAsyncOperator(
task_id="daily_rollup",
sql="CREATE OR REPLACE TABLE lake.default.daily_revenue AS …",
poll_interval=10,
timeout=1800,
)
After submitting, the task defers: the triggerer polls the execution and no
worker slot is held. The trigger resolves the connection itself, so the token
never travels through the metadata database. Requires a running triggerer.
Waiting on somebody else's execution
from thunderduck_airflow.sensors.execution import ThunderduckExecutionSensor
wait = ThunderduckExecutionSensor(
task_id="wait_for_export",
execution_id="{{ ti.xcom_pull(task_ids='submit_elsewhere')['execution_id'] }}",
mode="reschedule",
poke_interval=30,
)
Use it when the submit happens in another DAG or outside Airflow. A failed or cancelled execution fails the sensor immediately instead of waiting out its timeout.
Errors
Everything derives from airflow.exceptions.AirflowException:
| Exception | Meaning |
|---|---|
ThunderduckAuthError |
the token was rejected (401/403) — fix the connection |
ThunderduckQueryError |
the run finished in the error state |
ThunderduckTimeout |
the run was still going at the deadline |
ThunderduckError |
anything else: unreachable API, 4xx/5xx, cancelled run |
The token never appears in an exception message or the logs.
Limitations
- One statement per task. Thunderduck runs one statement per execution by design; split multi-statement scripts into tasks.
- Results stay in the lakehouse. This provider does not pull large results
through XCom — the execution id is the hand-off, and
GET /executions/{id}/download-urlreturns a presigned Parquet URL. - Airflow 3 only, as above.
Development
uv venv --python 3.12
uv pip install -e . "apache-airflow==3.4.0" pytest ruff
AIRFLOW_HOME=$(mktemp -d) uv run --no-sync pytest
uv run --no-sync ruff check . && uv run --no-sync ruff format --check .
The tests talk to an httpx.MockTransport; they never need a live API or a
metadata database.
License
Apache-2.0. Source: https://github.com/thunderduck-io/thunderduck-airflow
Metadata
Release files for thunderduck-airflow 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 |
|---|---|---|---|---|
| thunderduck_airflow-0.1.0.tar.gz | 18.8 kB | With provenance | Details for thunderduck_airflow-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thunderduck_airflow-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for thunderduck_airflow-0.1.0-py3-none-any.whl |
Total release size: 44.4 kB
Release files / thunderduck_airflow-0.1.0.tar.gz
| Download URL | thunderduck_airflow-0.1.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afd485411e27e7f41d9ddb9815b496d2ddc7fd909d030426152aa36d7f4cf835
|
|
BLAKE2b-256 checksum How to use checksums |
c269967621cd0bfe120f05cba602009d5be0f54f839b97b338a76adef05f47b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logRelease files / thunderduck_airflow-0.1.0-py3-none-any.whl
| Download URL | thunderduck_airflow-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f8af830e8482badbce6c9f1a48298c16c3a50a17b950e3f58f78517c4262ce2
|
|
BLAKE2b-256 checksum How to use checksums |
070415af8e3cd5223d4215dfdf3d63201a013d4d0f5bef9cb8ce7fb256f3ee50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logSecurity for thunderduck-airflow 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 thunderduck_airflow-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 Nov 25, 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.