thunderduck-airflow 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. thunderduck_airflow-0.1.0/LICENSE +202 -0
  2. thunderduck_airflow-0.1.0/PKG-INFO +182 -0
  3. thunderduck_airflow-0.1.0/README.md +155 -0
  4. thunderduck_airflow-0.1.0/pyproject.toml +69 -0
  5. thunderduck_airflow-0.1.0/pyproject.toml.orig +63 -0
  6. thunderduck_airflow-0.1.0/src/thunderduck_airflow/__init__.py +14 -0
  7. thunderduck_airflow-0.1.0/src/thunderduck_airflow/client.py +279 -0
  8. thunderduck_airflow-0.1.0/src/thunderduck_airflow/compat.py +15 -0
  9. thunderduck_airflow-0.1.0/src/thunderduck_airflow/example_dags/__init__.py +1 -0
  10. thunderduck_airflow-0.1.0/src/thunderduck_airflow/example_dags/example_thunderduck.py +52 -0
  11. thunderduck_airflow-0.1.0/src/thunderduck_airflow/exceptions.py +39 -0
  12. thunderduck_airflow-0.1.0/src/thunderduck_airflow/hooks/__init__.py +5 -0
  13. thunderduck_airflow-0.1.0/src/thunderduck_airflow/hooks/thunderduck.py +111 -0
  14. thunderduck_airflow-0.1.0/src/thunderduck_airflow/operators/__init__.py +6 -0
  15. thunderduck_airflow-0.1.0/src/thunderduck_airflow/operators/base.py +76 -0
  16. thunderduck_airflow-0.1.0/src/thunderduck_airflow/operators/query.py +70 -0
  17. thunderduck_airflow-0.1.0/src/thunderduck_airflow/operators/query_async.py +72 -0
  18. thunderduck_airflow-0.1.0/src/thunderduck_airflow/provider.py +18 -0
  19. thunderduck_airflow-0.1.0/src/thunderduck_airflow/provider.yaml +48 -0
  20. thunderduck_airflow-0.1.0/src/thunderduck_airflow/sensors/__init__.py +5 -0
  21. thunderduck_airflow-0.1.0/src/thunderduck_airflow/sensors/execution.py +63 -0
  22. thunderduck_airflow-0.1.0/src/thunderduck_airflow/triggers/__init__.py +5 -0
  23. thunderduck_airflow-0.1.0/src/thunderduck_airflow/triggers/execution.py +126 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: thunderduck-airflow
3
+ Version: 0.1.0
4
+ Summary: Apache Airflow provider for Thunderduck: run SQL, wait for the stored result, cancel cleanly and hand off Parquet.
5
+ Keywords: airflow,thunderduck,duckdb,iceberg,lakehouse,provider
6
+ Author: YILDIRIM ADIGUZEL
7
+ Author-email: YILDIRIM ADIGUZEL <developer@thunderduck.io>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Framework :: Apache Airflow
12
+ Classifier: Framework :: Apache Airflow :: Provider
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Database
18
+ Requires-Dist: apache-airflow>=3.0,<4
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Python: >=3.11
22
+ Project-URL: Homepage, https://thunderduck.ai
23
+ Project-URL: Documentation, https://docs.thunderduck.ai/clients/airflow
24
+ Project-URL: Source, https://github.com/thunderduck-io/thunderduck-airflow
25
+ Project-URL: Issues, https://github.com/thunderduck-io/thunderduck-airflow/issues
26
+ Description-Content-Type: text/markdown
27
+
28
+ # thunderduck-airflow
29
+
30
+ An Apache Airflow provider for [Thunderduck](https://thunderduck.ai): submit SQL
31
+ to the REST API, wait for the stored result, cancel cleanly, and hand the
32
+ execution id on to the next task.
33
+
34
+ ```bash
35
+ pip install thunderduck-airflow
36
+ ```
37
+
38
+ Requires Apache Airflow 3.0+ and Python 3.11+. Airflow 2 reached end of life on
39
+ 2026-04-22; this provider does not carry the compatibility shims for it.
40
+
41
+ ## The connection
42
+
43
+ Create an Airflow connection of type **Thunderduck** (or via the CLI/env):
44
+
45
+ | Field | Value |
46
+ | --- | --- |
47
+ | Conn Id | `thunderduck_default` (or your own) |
48
+ | Host | `api.thunderduck.ai` — `https://` is optional |
49
+ | Password | your Thunderduck API token |
50
+ | Extra | optional JSON, see below |
51
+
52
+ ```bash
53
+ airflow connections add thunderduck_default \
54
+ --conn-type thunderduck \
55
+ --conn-host api.thunderduck.ai \
56
+ --conn-password "$THUNDERDUCK_TOKEN"
57
+ ```
58
+
59
+ Extras:
60
+
61
+ ```json
62
+ {
63
+ "endpoint": "https://api.thunderduck.ai",
64
+ "timeout": 3600,
65
+ "poll_interval": 2,
66
+ "token": "tdk_..."
67
+ }
68
+ ```
69
+
70
+ `endpoint` wins over host/port, `timeout` is how long to wait for a *run*
71
+ (seconds, default 3600), `poll_interval` is the delay between status checks
72
+ (default 2), and `token` is an alternative to the password field. The **Test
73
+ connection** button performs one authenticated `GET /catalog/schema`.
74
+
75
+ ## Running a query
76
+
77
+ ```python
78
+ from thunderduck_airflow.operators.query import ThunderduckQueryOperator
79
+
80
+ preview = ThunderduckQueryOperator(
81
+ task_id="preview",
82
+ sql="""
83
+ SELECT region, sum(total) AS revenue
84
+ FROM sales_pg.public.orders
85
+ GROUP BY region
86
+ ORDER BY revenue DESC
87
+ """,
88
+ fetch_rows=50,
89
+ )
90
+ ```
91
+
92
+ The task returns, and pushes to XCom:
93
+
94
+ ```python
95
+ {"execution_id": "…", "row_count": 12, "columns": ["region", "revenue"], "rows": [...]}
96
+ ```
97
+
98
+ `columns`/`rows` are only present when `fetch_rows` is set. XCom lives in the
99
+ metadata database, so keep it small: for a real hand-off use the execution id
100
+ and fetch the Parquet export instead.
101
+
102
+ `sql` is templated, and a value ending in `.sql` is loaded from the DAG folder:
103
+
104
+ ```python
105
+ ThunderduckQueryOperator(task_id="daily", sql="sql/daily_revenue.sql")
106
+ ```
107
+
108
+ A failed, errored or timed-out run fails the task. The operator asks Thunderduck
109
+ to cancel the run first, so a retry does not leave the previous execution
110
+ burning compute; ``on_kill`` does the same when the task is cleared or killed.
111
+
112
+ ## Deferring to the triggerer
113
+
114
+ ```python
115
+ from thunderduck_airflow.operators.query_async import ThunderduckQueryAsyncOperator
116
+
117
+ rollup = ThunderduckQueryAsyncOperator(
118
+ task_id="daily_rollup",
119
+ sql="CREATE OR REPLACE TABLE lake.default.daily_revenue AS …",
120
+ poll_interval=10,
121
+ timeout=1800,
122
+ )
123
+ ```
124
+
125
+ After submitting, the task defers: the triggerer polls the execution and no
126
+ worker slot is held. The trigger resolves the connection itself, so the token
127
+ never travels through the metadata database. Requires a running `triggerer`.
128
+
129
+ ## Waiting on somebody else's execution
130
+
131
+ ```python
132
+ from thunderduck_airflow.sensors.execution import ThunderduckExecutionSensor
133
+
134
+ wait = ThunderduckExecutionSensor(
135
+ task_id="wait_for_export",
136
+ execution_id="{{ ti.xcom_pull(task_ids='submit_elsewhere')['execution_id'] }}",
137
+ mode="reschedule",
138
+ poke_interval=30,
139
+ )
140
+ ```
141
+
142
+ Use it when the submit happens in another DAG or outside Airflow. A failed or
143
+ cancelled execution fails the sensor immediately instead of waiting out its
144
+ timeout.
145
+
146
+ ## Errors
147
+
148
+ Everything derives from `airflow.exceptions.AirflowException`:
149
+
150
+ | Exception | Meaning |
151
+ | --- | --- |
152
+ | `ThunderduckAuthError` | the token was rejected (401/403) — fix the connection |
153
+ | `ThunderduckQueryError` | the run finished in the `error` state |
154
+ | `ThunderduckTimeout` | the run was still going at the deadline |
155
+ | `ThunderduckError` | anything else: unreachable API, 4xx/5xx, cancelled run |
156
+
157
+ The token never appears in an exception message or the logs.
158
+
159
+ ## Limitations
160
+
161
+ * One statement per task. Thunderduck runs one statement per execution by
162
+ design; split multi-statement scripts into tasks.
163
+ * Results stay in the lakehouse. This provider does not pull large results
164
+ through XCom — the execution id is the hand-off, and
165
+ `GET /executions/{id}/download-url` returns a presigned Parquet URL.
166
+ * Airflow 3 only, as above.
167
+
168
+ ## Development
169
+
170
+ ```bash
171
+ uv venv --python 3.12
172
+ uv pip install -e . "apache-airflow==3.4.0" pytest ruff
173
+ AIRFLOW_HOME=$(mktemp -d) uv run --no-sync pytest
174
+ uv run --no-sync ruff check . && uv run --no-sync ruff format --check .
175
+ ```
176
+
177
+ The tests talk to an `httpx.MockTransport`; they never need a live API or a
178
+ metadata database.
179
+
180
+ ## License
181
+
182
+ Apache-2.0. Source: https://github.com/thunderduck-io/thunderduck-airflow
@@ -0,0 +1,155 @@
1
+ # thunderduck-airflow
2
+
3
+ An Apache Airflow provider for [Thunderduck](https://thunderduck.ai): submit SQL
4
+ to the REST API, wait for the stored result, cancel cleanly, and hand the
5
+ execution id on to the next task.
6
+
7
+ ```bash
8
+ pip install thunderduck-airflow
9
+ ```
10
+
11
+ Requires Apache Airflow 3.0+ and Python 3.11+. Airflow 2 reached end of life on
12
+ 2026-04-22; this provider does not carry the compatibility shims for it.
13
+
14
+ ## The connection
15
+
16
+ Create an Airflow connection of type **Thunderduck** (or via the CLI/env):
17
+
18
+ | Field | Value |
19
+ | --- | --- |
20
+ | Conn Id | `thunderduck_default` (or your own) |
21
+ | Host | `api.thunderduck.ai` — `https://` is optional |
22
+ | Password | your Thunderduck API token |
23
+ | Extra | optional JSON, see below |
24
+
25
+ ```bash
26
+ airflow connections add thunderduck_default \
27
+ --conn-type thunderduck \
28
+ --conn-host api.thunderduck.ai \
29
+ --conn-password "$THUNDERDUCK_TOKEN"
30
+ ```
31
+
32
+ Extras:
33
+
34
+ ```json
35
+ {
36
+ "endpoint": "https://api.thunderduck.ai",
37
+ "timeout": 3600,
38
+ "poll_interval": 2,
39
+ "token": "tdk_..."
40
+ }
41
+ ```
42
+
43
+ `endpoint` wins over host/port, `timeout` is how long to wait for a *run*
44
+ (seconds, default 3600), `poll_interval` is the delay between status checks
45
+ (default 2), and `token` is an alternative to the password field. The **Test
46
+ connection** button performs one authenticated `GET /catalog/schema`.
47
+
48
+ ## Running a query
49
+
50
+ ```python
51
+ from thunderduck_airflow.operators.query import ThunderduckQueryOperator
52
+
53
+ preview = ThunderduckQueryOperator(
54
+ task_id="preview",
55
+ sql="""
56
+ SELECT region, sum(total) AS revenue
57
+ FROM sales_pg.public.orders
58
+ GROUP BY region
59
+ ORDER BY revenue DESC
60
+ """,
61
+ fetch_rows=50,
62
+ )
63
+ ```
64
+
65
+ The task returns, and pushes to XCom:
66
+
67
+ ```python
68
+ {"execution_id": "…", "row_count": 12, "columns": ["region", "revenue"], "rows": [...]}
69
+ ```
70
+
71
+ `columns`/`rows` are only present when `fetch_rows` is set. XCom lives in the
72
+ metadata database, so keep it small: for a real hand-off use the execution id
73
+ and fetch the Parquet export instead.
74
+
75
+ `sql` is templated, and a value ending in `.sql` is loaded from the DAG folder:
76
+
77
+ ```python
78
+ ThunderduckQueryOperator(task_id="daily", sql="sql/daily_revenue.sql")
79
+ ```
80
+
81
+ A failed, errored or timed-out run fails the task. The operator asks Thunderduck
82
+ to cancel the run first, so a retry does not leave the previous execution
83
+ burning compute; ``on_kill`` does the same when the task is cleared or killed.
84
+
85
+ ## Deferring to the triggerer
86
+
87
+ ```python
88
+ from thunderduck_airflow.operators.query_async import ThunderduckQueryAsyncOperator
89
+
90
+ rollup = ThunderduckQueryAsyncOperator(
91
+ task_id="daily_rollup",
92
+ sql="CREATE OR REPLACE TABLE lake.default.daily_revenue AS …",
93
+ poll_interval=10,
94
+ timeout=1800,
95
+ )
96
+ ```
97
+
98
+ After submitting, the task defers: the triggerer polls the execution and no
99
+ worker slot is held. The trigger resolves the connection itself, so the token
100
+ never travels through the metadata database. Requires a running `triggerer`.
101
+
102
+ ## Waiting on somebody else's execution
103
+
104
+ ```python
105
+ from thunderduck_airflow.sensors.execution import ThunderduckExecutionSensor
106
+
107
+ wait = ThunderduckExecutionSensor(
108
+ task_id="wait_for_export",
109
+ execution_id="{{ ti.xcom_pull(task_ids='submit_elsewhere')['execution_id'] }}",
110
+ mode="reschedule",
111
+ poke_interval=30,
112
+ )
113
+ ```
114
+
115
+ Use it when the submit happens in another DAG or outside Airflow. A failed or
116
+ cancelled execution fails the sensor immediately instead of waiting out its
117
+ timeout.
118
+
119
+ ## Errors
120
+
121
+ Everything derives from `airflow.exceptions.AirflowException`:
122
+
123
+ | Exception | Meaning |
124
+ | --- | --- |
125
+ | `ThunderduckAuthError` | the token was rejected (401/403) — fix the connection |
126
+ | `ThunderduckQueryError` | the run finished in the `error` state |
127
+ | `ThunderduckTimeout` | the run was still going at the deadline |
128
+ | `ThunderduckError` | anything else: unreachable API, 4xx/5xx, cancelled run |
129
+
130
+ The token never appears in an exception message or the logs.
131
+
132
+ ## Limitations
133
+
134
+ * One statement per task. Thunderduck runs one statement per execution by
135
+ design; split multi-statement scripts into tasks.
136
+ * Results stay in the lakehouse. This provider does not pull large results
137
+ through XCom — the execution id is the hand-off, and
138
+ `GET /executions/{id}/download-url` returns a presigned Parquet URL.
139
+ * Airflow 3 only, as above.
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ uv venv --python 3.12
145
+ uv pip install -e . "apache-airflow==3.4.0" pytest ruff
146
+ AIRFLOW_HOME=$(mktemp -d) uv run --no-sync pytest
147
+ uv run --no-sync ruff check . && uv run --no-sync ruff format --check .
148
+ ```
149
+
150
+ The tests talk to an `httpx.MockTransport`; they never need a live API or a
151
+ metadata database.
152
+
153
+ ## License
154
+
155
+ Apache-2.0. Source: https://github.com/thunderduck-io/thunderduck-airflow
@@ -0,0 +1,69 @@
1
+ [project]
2
+ name = "thunderduck-airflow"
3
+ version = "0.1.0"
4
+ description = "Apache Airflow provider for Thunderduck: run SQL, wait for the stored result, cancel cleanly and hand off Parquet."
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "airflow",
11
+ "thunderduck",
12
+ "duckdb",
13
+ "iceberg",
14
+ "lakehouse",
15
+ "provider",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Framework :: Apache Airflow",
20
+ "Framework :: Apache Airflow :: Provider",
21
+ "Intended Audience :: Developers",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Database",
26
+ ]
27
+ dependencies = [
28
+ "apache-airflow>=3.0,<4",
29
+ "httpx>=0.27",
30
+ "pyyaml>=6.0",
31
+ ]
32
+
33
+ [[project.authors]]
34
+ name = "YILDIRIM ADIGUZEL"
35
+ email = "developer@thunderduck.io"
36
+
37
+ [project.urls]
38
+ Homepage = "https://thunderduck.ai"
39
+ Documentation = "https://docs.thunderduck.ai/clients/airflow"
40
+ Source = "https://github.com/thunderduck-io/thunderduck-airflow"
41
+ Issues = "https://github.com/thunderduck-io/thunderduck-airflow/issues"
42
+
43
+ [project.entry-points.apache_airflow_provider]
44
+ provider_info = "thunderduck_airflow.provider:get_provider_info"
45
+
46
+ [dependency-groups]
47
+ dev = [
48
+ "pytest>=8.0.0",
49
+ "ruff>=0.8.0",
50
+ ]
51
+
52
+ [build-system]
53
+ requires = ["uv_build>=0.12.1,<0.13.0"]
54
+ build-backend = "uv_build"
55
+
56
+ [tool.pytest.ini_options]
57
+ testpaths = ["tests"]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py311"
62
+
63
+ [tool.ruff.lint]
64
+ select = [
65
+ "E",
66
+ "F",
67
+ "I",
68
+ "UP",
69
+ ]
@@ -0,0 +1,63 @@
1
+ [project]
2
+ name = "thunderduck-airflow"
3
+ version = "0.1.0"
4
+ description = "Apache Airflow provider for Thunderduck: run SQL, wait for the stored result, cancel cleanly and hand off Parquet."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "YILDIRIM ADIGUZEL", email = "developer@thunderduck.io" }
8
+ ]
9
+ requires-python = ">=3.11"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+ keywords = ["airflow", "thunderduck", "duckdb", "iceberg", "lakehouse", "provider"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Framework :: Apache Airflow",
16
+ "Framework :: Apache Airflow :: Provider",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Database",
22
+ ]
23
+ # Airflow 2 reached end of life on 2026-04-22; this provider targets the 3.x
24
+ # line only, which also keeps it free of the 2.x compatibility shims.
25
+ dependencies = [
26
+ "apache-airflow>=3.0,<4",
27
+ "httpx>=0.27",
28
+ # Airflow already ships PyYAML; declared because provider.py imports it
29
+ # directly to read provider.yaml.
30
+ "pyyaml>=6.0",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://thunderduck.ai"
35
+ Documentation = "https://docs.thunderduck.ai/clients/airflow"
36
+ Source = "https://github.com/thunderduck-io/thunderduck-airflow"
37
+ Issues = "https://github.com/thunderduck-io/thunderduck-airflow/issues"
38
+
39
+ # Airflow's provider manager reads this entry point: it is what makes
40
+ # `conn_type=thunderduck` appear in the connection UI and `airflow providers
41
+ # list` show the provider.
42
+ [project.entry-points."apache_airflow_provider"]
43
+ provider_info = "thunderduck_airflow.provider:get_provider_info"
44
+
45
+ [dependency-groups]
46
+ dev = [
47
+ "pytest>=8.0.0",
48
+ "ruff>=0.8.0",
49
+ ]
50
+
51
+ [build-system]
52
+ requires = ["uv_build>=0.12.1,<0.13.0"]
53
+ build-backend = "uv_build"
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+
58
+ [tool.ruff]
59
+ line-length = 100
60
+ target-version = "py311"
61
+
62
+ [tool.ruff.lint]
63
+ select = ["E", "F", "I", "UP"]
@@ -0,0 +1,14 @@
1
+ """Apache Airflow provider for Thunderduck.
2
+
3
+ Submits SQL to the Thunderduck REST API, waits for the stored result and hands
4
+ back an execution id — synchronously on a worker or deferrably on a triggerer.
5
+ """
6
+
7
+ from importlib.metadata import PackageNotFoundError, version
8
+
9
+ try:
10
+ __version__ = version("thunderduck-airflow")
11
+ except PackageNotFoundError: # running from a source tree without metadata
12
+ __version__ = "0.0.0"
13
+
14
+ __all__ = ["__version__"]