apache-airflow-providers-apache-arrow 0.1.0__py3-none-any.whl
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.
- airflow/providers/apache/arrow/LICENSE +201 -0
- airflow/providers/apache/arrow/__init__.py +39 -0
- airflow/providers/apache/arrow/get_provider_info.py +55 -0
- airflow/providers/apache/arrow/hooks/__init__.py +16 -0
- airflow/providers/apache/arrow/hooks/adbc.py +345 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/METADATA +143 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/RECORD +11 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/WHEEL +4 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/entry_points.txt +3 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/licenses/LICENSE +201 -0
- apache_airflow_providers_apache_arrow-0.1.0.dist-info/licenses/NOTICE +5 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
#
|
|
18
|
+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
|
|
19
|
+
# OVERWRITTEN WHEN PREPARING DOCUMENTATION FOR THE PACKAGES.
|
|
20
|
+
#
|
|
21
|
+
# IF YOU WANT TO MODIFY THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
22
|
+
# `PROVIDER__INIT__PY_TEMPLATE.py.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
|
23
|
+
#
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import packaging.version
|
|
27
|
+
|
|
28
|
+
from airflow import __version__ as airflow_version
|
|
29
|
+
|
|
30
|
+
__all__ = ["__version__"]
|
|
31
|
+
|
|
32
|
+
__version__ = "0.1.0"
|
|
33
|
+
|
|
34
|
+
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
|
+
"2.11.0"
|
|
36
|
+
):
|
|
37
|
+
raise RuntimeError(
|
|
38
|
+
f"The package `apache-airflow-providers-apache-arrow:{__version__}` needs Apache Airflow 2.11.0+"
|
|
39
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
|
|
19
|
+
#
|
|
20
|
+
# IF YOU WANT TO MODIFY THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
21
|
+
# `get_provider_info_TEMPLATE.py.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_provider_info():
|
|
25
|
+
return {
|
|
26
|
+
"package-name": "apache-airflow-providers-apache-arrow",
|
|
27
|
+
"name": "Apache Arrow",
|
|
28
|
+
"description": "`Apache Arrow <https://arrow.apache.org/>`__ provider for Airflow. Offers ``AdbcHook``,\na general-purpose hook that connects to any database supported by an\n`Arrow Database Connectivity (ADBC) <https://arrow.apache.org/adbc/>`__ driver\n(PostgreSQL, SQLite, DuckDB, Snowflake, BigQuery, Flight SQL, and more) and transfers data\nas columnar Arrow ``RecordBatch`` objects for efficient, zero-copy bulk loads.\n",
|
|
29
|
+
"integrations": [
|
|
30
|
+
{
|
|
31
|
+
"integration-name": "Apache Arrow",
|
|
32
|
+
"external-doc-url": "https://arrow.apache.org/",
|
|
33
|
+
"how-to-guide": ["/docs/apache-airflow-providers-apache-arrow/operators.rst"],
|
|
34
|
+
"logo": "/docs/integration-logos/apache-arrow.png",
|
|
35
|
+
"tags": ["apache"],
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"integration-name": "Apache Arrow",
|
|
41
|
+
"python-modules": ["airflow.providers.apache.arrow.hooks.adbc"],
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"connection-types": [
|
|
45
|
+
{
|
|
46
|
+
"hook-class-name": "airflow.providers.apache.arrow.hooks.adbc.AdbcHook",
|
|
47
|
+
"hook-name": "ADBC Connection",
|
|
48
|
+
"connection-type": "adbc",
|
|
49
|
+
"ui-field-behaviour": {
|
|
50
|
+
"hidden-fields": ["port", "schema"],
|
|
51
|
+
"relabeling": {"host": "Connection URL"},
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
|
4
|
+
# distributed with this work for additional information
|
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
|
7
|
+
# "License"); you may not use this file except in compliance
|
|
8
|
+
# with the License. You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
|
13
|
+
# software distributed under the License is distributed on an
|
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
# KIND, either express or implied. See the License for the
|
|
16
|
+
# specific language governing permissions and limitations
|
|
17
|
+
# under the License.
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import contextlib
|
|
21
|
+
import pathlib
|
|
22
|
+
import re
|
|
23
|
+
import sys
|
|
24
|
+
from collections.abc import Callable, Iterable, Mapping
|
|
25
|
+
from contextlib import closing
|
|
26
|
+
from functools import cached_property
|
|
27
|
+
from importlib import resources as importlib_resources
|
|
28
|
+
from typing import TYPE_CHECKING, Any
|
|
29
|
+
|
|
30
|
+
from adbc_driver_manager.dbapi import Connection, connect
|
|
31
|
+
from more_itertools import chunked
|
|
32
|
+
from pyarrow import RecordBatch, Schema, array, schema
|
|
33
|
+
|
|
34
|
+
from airflow.providers.common.sql.dialects.dialect import Dialect
|
|
35
|
+
from airflow.providers.common.sql.hooks.sql import DbApiHook
|
|
36
|
+
|
|
37
|
+
if TYPE_CHECKING:
|
|
38
|
+
from adbc_driver_manager.dbapi import Cursor
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def fetch_all_handler(cursor) -> list[tuple] | None:
|
|
42
|
+
"""Return results for DbApiHook.run()."""
|
|
43
|
+
if not hasattr(cursor, "description"):
|
|
44
|
+
raise RuntimeError(
|
|
45
|
+
"The database we interact with does not support DBAPI 2.0. Use operator and "
|
|
46
|
+
"handlers that are specifically designed for your database."
|
|
47
|
+
)
|
|
48
|
+
if cursor.description is not None:
|
|
49
|
+
table = cursor.fetch_arrow_table()
|
|
50
|
+
return list(zip(*(column.to_pylist() for column in table.columns)))
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def replace_placeholders(sql: str, placeholder: str) -> str:
|
|
55
|
+
# Replace each placeholder with $1, $2, $3 ... in order
|
|
56
|
+
counter = [1]
|
|
57
|
+
|
|
58
|
+
def replacer(match):
|
|
59
|
+
replacement = f"${counter[0]}"
|
|
60
|
+
counter[0] += 1
|
|
61
|
+
return replacement
|
|
62
|
+
|
|
63
|
+
return re.sub(placeholder, replacer, sql)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# https://arrow.apache.org/adbc/current/python/api/adbc_driver_manager.html
|
|
67
|
+
# https://arrow.apache.org/docs/python/
|
|
68
|
+
class AdbcHook(DbApiHook):
|
|
69
|
+
"""
|
|
70
|
+
General-purpose Airflow hook for interacting with databases via the Arrow Database Connectivity (ADBC) standard.
|
|
71
|
+
|
|
72
|
+
This hook enables connections to any database supported by an ADBC driver, using the Python ADBC driver manager.
|
|
73
|
+
It provides methods for executing SQL queries, inserting rows in bulk, and handling Arrow-native data transfers.
|
|
74
|
+
|
|
75
|
+
Key Features:
|
|
76
|
+
- Supports chunked and batched inserts using Apache Arrow RecordBatches for efficient data transfer.
|
|
77
|
+
- Discovers and loads ADBC drivers dynamically based on connection extras or naming conventions.
|
|
78
|
+
- Handles dialect-specific connection URIs and driver entrypoints.
|
|
79
|
+
- Integrates with Airflow's connection system (conn_id, extras, etc.).
|
|
80
|
+
- Provides custom placeholder replacement for parameterized SQL queries.
|
|
81
|
+
- Supports both native Arrow binding and DBAPI ``executemany`` for inserts.
|
|
82
|
+
- Exposes configuration via connection extras: driver, entrypoint, db_kwargs, conn_kwargs, dialect.
|
|
83
|
+
|
|
84
|
+
Connection Extras:
|
|
85
|
+
- driver: Name of the ADBC driver to use (e.g., "adbc_driver_postgresql").
|
|
86
|
+
- entrypoint: Optional Python entrypoint for the driver.
|
|
87
|
+
- db_kwargs: Driver-specific database initialization options passed to
|
|
88
|
+
``AdbcDatabase``. Keys and value types are defined by the driver
|
|
89
|
+
(e.g., ``"username"``, ``"password"`` for the PostgreSQL driver).
|
|
90
|
+
Do **not** put ADBC connection options here — they belong in
|
|
91
|
+
``conn_kwargs``.
|
|
92
|
+
- conn_kwargs: ADBC connection options as string key-value pairs.
|
|
93
|
+
Keys must use the canonical dotted ADBC option names, for example:
|
|
94
|
+
``"adbc.connection.autocommit": "true"``,
|
|
95
|
+
``"adbc.connection.read_only": "true"``,
|
|
96
|
+
``"adbc.connection.current_catalog": "my_catalog"``,
|
|
97
|
+
``"adbc.connection.current_db_schema": "my_schema"``.
|
|
98
|
+
Short names such as ``autocommit`` or ``read_only`` are **not**
|
|
99
|
+
recognized by ADBC drivers and will raise ``NotSupportedError``.
|
|
100
|
+
- dialect: SQL dialect name (default: "default").
|
|
101
|
+
|
|
102
|
+
Example usage:
|
|
103
|
+
hook = AdbcHook(adbc_conn_id="my_adbc_conn")
|
|
104
|
+
records = hook.get_records("SELECT * FROM my_table")
|
|
105
|
+
|
|
106
|
+
For more details, see:
|
|
107
|
+
- Apache Arrow ADBC Python API: https://arrow.apache.org/adbc/current/python/api/adbc_driver_manager.html
|
|
108
|
+
- Airflow SQL hooks: https://airflow.apache.org/docs/apache-airflow/stable/howto/custom-operator.html#hooks
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
conn_name_attr = "adbc_conn_id"
|
|
112
|
+
default_conn_name = "adbc_default"
|
|
113
|
+
conn_type = "adbc"
|
|
114
|
+
hook_name = "ADBC Connection"
|
|
115
|
+
supports_autocommit = True
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def get_ui_field_behaviour(cls) -> dict[str, Any]:
|
|
119
|
+
"""Get custom field behaviour."""
|
|
120
|
+
return {
|
|
121
|
+
"hidden_fields": ["port", "schema"],
|
|
122
|
+
"relabeling": {"host": "Connection URL"},
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@cached_property
|
|
126
|
+
def _driver_path(self) -> str:
|
|
127
|
+
# Wheels bundle the shared library
|
|
128
|
+
root = importlib_resources.files(self.driver)
|
|
129
|
+
# The filename is always the same regardless of platform
|
|
130
|
+
entrypoint = root.joinpath(f"lib{self.driver}.so")
|
|
131
|
+
if entrypoint.is_file():
|
|
132
|
+
return str(entrypoint)
|
|
133
|
+
|
|
134
|
+
# Search sys.prefix + '/lib' (Unix, Conda on Unix)
|
|
135
|
+
root = pathlib.Path(sys.prefix)
|
|
136
|
+
for filename in (f"lib{self.driver}.so", f"lib{self.driver}.dylib"):
|
|
137
|
+
entrypoint = root.joinpath("lib", filename)
|
|
138
|
+
if entrypoint.is_file():
|
|
139
|
+
return str(entrypoint)
|
|
140
|
+
|
|
141
|
+
# Conda on Windows
|
|
142
|
+
entrypoint = root.joinpath("bin", f"{self.driver}.dll")
|
|
143
|
+
if entrypoint.is_file():
|
|
144
|
+
return str(entrypoint)
|
|
145
|
+
|
|
146
|
+
# Let the driver manager fall back to (DY)LD_LIBRARY_PATH/PATH
|
|
147
|
+
# (It will insert 'lib', 'so', etc. as needed)
|
|
148
|
+
return self.driver
|
|
149
|
+
|
|
150
|
+
@cached_property
|
|
151
|
+
def uri(self) -> str:
|
|
152
|
+
host = self.connection.host
|
|
153
|
+
if host and "::" in str(host):
|
|
154
|
+
return str(host)
|
|
155
|
+
uri = self.get_uri()
|
|
156
|
+
return uri.replace(
|
|
157
|
+
f"{self.conn_type.lower().replace('_', '-')}://",
|
|
158
|
+
f"{self.dialect_name.lower().replace('_', '-')}://",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
@cached_property
|
|
162
|
+
def driver(self) -> str:
|
|
163
|
+
return self.connection_extra_lower.get("driver") or f"adbc_driver_{self.dialect_name}"
|
|
164
|
+
|
|
165
|
+
@cached_property
|
|
166
|
+
def entrypoint(self) -> str | None:
|
|
167
|
+
return self.connection_extra_lower.get("entrypoint")
|
|
168
|
+
|
|
169
|
+
@cached_property
|
|
170
|
+
def db_kwargs(self) -> dict:
|
|
171
|
+
return {**{"uri": self.uri}, **self.connection_extra_lower.get("db_kwargs", {})}
|
|
172
|
+
|
|
173
|
+
@cached_property
|
|
174
|
+
def conn_kwargs(self) -> dict:
|
|
175
|
+
return self.connection_extra_lower.get("conn_kwargs", {})
|
|
176
|
+
|
|
177
|
+
@cached_property
|
|
178
|
+
def dialect_name(self) -> str:
|
|
179
|
+
return self.connection_extra_lower.get("dialect", "default")
|
|
180
|
+
|
|
181
|
+
def get_conn(self) -> Connection:
|
|
182
|
+
return connect(
|
|
183
|
+
driver=self._driver_path,
|
|
184
|
+
entrypoint=self.entrypoint,
|
|
185
|
+
db_kwargs=self.db_kwargs,
|
|
186
|
+
conn_kwargs=self.conn_kwargs,
|
|
187
|
+
autocommit=False,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
def set_autocommit(self, conn: Connection, autocommit: bool) -> None:
|
|
191
|
+
"""
|
|
192
|
+
Set autocommit on the ADBC connection.
|
|
193
|
+
|
|
194
|
+
The DBAPI attribute ``conn.autocommit`` has no effect on the underlying
|
|
195
|
+
ADBC driver; the real lever is the ``adbc.connection.autocommit`` option.
|
|
196
|
+
This override applies the option at the driver level, then calls super()
|
|
197
|
+
to keep the Python-level bookkeeping attribute in sync so that the base
|
|
198
|
+
class ``get_autocommit()`` and ``run()`` commit-guard behave correctly.
|
|
199
|
+
"""
|
|
200
|
+
conn.adbc_connection.set_autocommit(autocommit)
|
|
201
|
+
super().set_autocommit(conn, autocommit)
|
|
202
|
+
|
|
203
|
+
def get_records(
|
|
204
|
+
self,
|
|
205
|
+
sql: str | list[str],
|
|
206
|
+
parameters: Iterable | Mapping[str, Any] | None = None,
|
|
207
|
+
) -> Any:
|
|
208
|
+
"""
|
|
209
|
+
Execute the sql and return a set of records.
|
|
210
|
+
|
|
211
|
+
:param sql: the sql statement to be executed (str) or a list of sql statements to execute
|
|
212
|
+
:param parameters: The parameters to render the SQL query with.
|
|
213
|
+
"""
|
|
214
|
+
return self.run(sql=sql, parameters=parameters, handler=fetch_all_handler)
|
|
215
|
+
|
|
216
|
+
def _run_command(self, cur, sql_statement, parameters):
|
|
217
|
+
"""Run a statement using an already open cursor."""
|
|
218
|
+
if parameters:
|
|
219
|
+
sql_statement = replace_placeholders(sql_statement, re.escape(self.dialect.placeholder))
|
|
220
|
+
|
|
221
|
+
super()._run_command(cur, sql_statement, parameters)
|
|
222
|
+
|
|
223
|
+
def _generate_insert_sql(self, table, values, target_fields=None, replace: bool = False, **kwargs) -> str:
|
|
224
|
+
sql_statement = super()._generate_insert_sql(
|
|
225
|
+
table, values, target_fields=target_fields, replace=replace, **kwargs
|
|
226
|
+
)
|
|
227
|
+
sql_statement = replace_placeholders(sql_statement, re.escape(self.dialect.placeholder))
|
|
228
|
+
|
|
229
|
+
if self.log_sql:
|
|
230
|
+
self.log.info("Running statement: %s", sql_statement)
|
|
231
|
+
|
|
232
|
+
return sql_statement
|
|
233
|
+
|
|
234
|
+
@classmethod
|
|
235
|
+
def _to_record_batch(cls, rows, schema: Schema) -> RecordBatch:
|
|
236
|
+
return RecordBatch.from_arrays(
|
|
237
|
+
[array([row[index] for row in rows], type=field.type) for index, field in enumerate(schema)],
|
|
238
|
+
schema=schema,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
@classmethod
|
|
242
|
+
def _execute_executemany(cls, cursor, statement: str, record_batch: RecordBatch) -> None:
|
|
243
|
+
"""
|
|
244
|
+
Execute a statement using cursor.executemany with a RecordBatch.
|
|
245
|
+
|
|
246
|
+
ADBC's executemany() accepts Arrow data directly and routes it through
|
|
247
|
+
bind_stream internally, making this the Arrow-native fast path.
|
|
248
|
+
"""
|
|
249
|
+
cursor.executemany(statement, record_batch)
|
|
250
|
+
|
|
251
|
+
def _resolve_execute_batch(
|
|
252
|
+
self, cursor, executemany: bool, fast_executemany: bool
|
|
253
|
+
) -> Callable[[Cursor, str, RecordBatch], None]:
|
|
254
|
+
"""
|
|
255
|
+
Return the batch-execute callable for the given cursor.
|
|
256
|
+
|
|
257
|
+
ADBC's executemany() natively accepts a RecordBatch, so it is always
|
|
258
|
+
the fast path. fast_executemany is passed through to drivers that
|
|
259
|
+
expose that knob (silently ignored otherwise).
|
|
260
|
+
"""
|
|
261
|
+
if fast_executemany:
|
|
262
|
+
with contextlib.suppress(AttributeError):
|
|
263
|
+
cursor.fast_executemany = True
|
|
264
|
+
self.log.info(
|
|
265
|
+
"Fast_executemany is enabled for conn_id '%s'!",
|
|
266
|
+
self.get_conn_id(),
|
|
267
|
+
)
|
|
268
|
+
return self._execute_executemany
|
|
269
|
+
|
|
270
|
+
def insert_rows(
|
|
271
|
+
self,
|
|
272
|
+
table,
|
|
273
|
+
rows,
|
|
274
|
+
target_fields=None,
|
|
275
|
+
commit_every=1000,
|
|
276
|
+
replace=False,
|
|
277
|
+
*,
|
|
278
|
+
executemany=False,
|
|
279
|
+
fast_executemany=False,
|
|
280
|
+
autocommit=False,
|
|
281
|
+
**kwargs,
|
|
282
|
+
):
|
|
283
|
+
"""
|
|
284
|
+
Insert a collection of tuples into a table.
|
|
285
|
+
|
|
286
|
+
Rows are inserted in chunks, each chunk (of size ``commit_every``) is
|
|
287
|
+
done in a new transaction.
|
|
288
|
+
|
|
289
|
+
:param table: Name of the target table
|
|
290
|
+
:param rows: The rows to insert into the table
|
|
291
|
+
:param target_fields: The names of the columns to fill in the table
|
|
292
|
+
:param commit_every: The maximum number of rows to insert in one
|
|
293
|
+
transaction. Set to 0 to insert all rows in one transaction.
|
|
294
|
+
:param replace: Whether to replace instead of insert
|
|
295
|
+
:param executemany: If True, all rows are inserted at once in
|
|
296
|
+
chunks defined by the commit_every parameter. This only works if all rows
|
|
297
|
+
have same number of column names, but leads to better performance.
|
|
298
|
+
:param fast_executemany: If True, the `fast_executemany` parameter will be set on the
|
|
299
|
+
cursor used by `executemany` which leads to better performance, if supported by driver.
|
|
300
|
+
:param autocommit: What to set the connection's autocommit setting to
|
|
301
|
+
before executing the query.
|
|
302
|
+
"""
|
|
303
|
+
nb_rows = 0
|
|
304
|
+
|
|
305
|
+
with self._create_autocommit_connection(autocommit) as conn:
|
|
306
|
+
table_name, schema_name = Dialect.extract_schema_from_table(table)
|
|
307
|
+
|
|
308
|
+
table_schema = conn.adbc_get_table_schema(
|
|
309
|
+
table_name=table_name,
|
|
310
|
+
db_schema_filter=schema_name,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
if not target_fields:
|
|
314
|
+
target_fields = table_schema.names
|
|
315
|
+
else:
|
|
316
|
+
fields = {field.name: field for field in table_schema}
|
|
317
|
+
table_schema = schema([fields[name] for name in target_fields])
|
|
318
|
+
|
|
319
|
+
self.log.info("target fields: %s", target_fields)
|
|
320
|
+
self.log.info("table_schema: %s", table_schema)
|
|
321
|
+
|
|
322
|
+
sql = self._generate_insert_sql(
|
|
323
|
+
table,
|
|
324
|
+
target_fields, # values not needed — parameters will come from RecordBatch
|
|
325
|
+
target_fields,
|
|
326
|
+
replace,
|
|
327
|
+
**kwargs,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
with closing(conn.cursor()) as cur:
|
|
331
|
+
execute_batch = self._resolve_execute_batch(
|
|
332
|
+
cur, executemany=executemany, fast_executemany=fast_executemany
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
for chunked_rows in chunked(rows, commit_every or None):
|
|
336
|
+
batch = self._to_record_batch(rows=chunked_rows, schema=table_schema)
|
|
337
|
+
execute_batch(cur, sql, batch)
|
|
338
|
+
|
|
339
|
+
if not autocommit:
|
|
340
|
+
conn.commit()
|
|
341
|
+
|
|
342
|
+
nb_rows += batch.num_rows
|
|
343
|
+
self.log.info("Loaded %s rows into %s so far", nb_rows, table)
|
|
344
|
+
|
|
345
|
+
self.log.info("Done loading. Loaded a total of %s rows into %s", nb_rows, table)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: apache-airflow-providers-apache-arrow
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Provider package apache-airflow-providers-apache-arrow for Apache Airflow
|
|
5
|
+
Keywords: airflow-provider,apache.arrow,airflow,integration
|
|
6
|
+
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
7
|
+
Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/x-rst
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Framework :: Apache Airflow
|
|
17
|
+
Classifier: Framework :: Apache Airflow :: Provider
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: System :: Monitoring
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: apache-airflow>=2.11.0
|
|
27
|
+
Requires-Dist: apache-airflow-providers-common-sql>=1.28.2
|
|
28
|
+
Requires-Dist: adbc-driver-manager>=1.7.0
|
|
29
|
+
Requires-Dist: more-itertools>=9.0.0
|
|
30
|
+
Requires-Dist: pyarrow>=16.1.0; python_version < '3.13'
|
|
31
|
+
Requires-Dist: pyarrow>=18.0.0; python_version >= '3.13'
|
|
32
|
+
Requires-Dist: adbc-driver-sqlite>=1.7.0 ; extra == "all"
|
|
33
|
+
Requires-Dist: adbc-driver-snowflake>=1.7.0 ; extra == "all"
|
|
34
|
+
Requires-Dist: adbc-driver-bigquery>=1.7.0 ; extra == "all"
|
|
35
|
+
Requires-Dist: adbc-driver-flightsql>=1.7.0 ; extra == "all"
|
|
36
|
+
Requires-Dist: adbc-driver-postgresql>=1.7.0 ; extra == "all"
|
|
37
|
+
Requires-Dist: adbc-driver-bigquery>=1.7.0 ; extra == "bigquery"
|
|
38
|
+
Requires-Dist: adbc-driver-flightsql>=1.7.0 ; extra == "flightsql"
|
|
39
|
+
Requires-Dist: adbc-driver-postgresql>=1.7.0 ; extra == "postgresql"
|
|
40
|
+
Requires-Dist: adbc-driver-snowflake>=1.7.0 ; extra == "snowflake"
|
|
41
|
+
Requires-Dist: adbc-driver-sqlite>=1.7.0 ; extra == "sqlite"
|
|
42
|
+
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
43
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-apache-arrow/0.1.0/changelog.html
|
|
44
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-apache-arrow/0.1.0
|
|
45
|
+
Project-URL: Mastodon, https://fosstodon.org/@airflow
|
|
46
|
+
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
47
|
+
Project-URL: Source Code, https://github.com/apache/airflow
|
|
48
|
+
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Provides-Extra: bigquery
|
|
51
|
+
Provides-Extra: flightsql
|
|
52
|
+
Provides-Extra: postgresql
|
|
53
|
+
Provides-Extra: snowflake
|
|
54
|
+
Provides-Extra: sqlite
|
|
55
|
+
Import-Name: airflow.providers.apache.arrow
|
|
56
|
+
Import-Namespace: airflow
|
|
57
|
+
Import-Namespace: airflow.providers
|
|
58
|
+
Import-Namespace: airflow.providers.apache
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
|
62
|
+
or more contributor license agreements. See the NOTICE file
|
|
63
|
+
distributed with this work for additional information
|
|
64
|
+
regarding copyright ownership. The ASF licenses this file
|
|
65
|
+
to you under the Apache License, Version 2.0 (the
|
|
66
|
+
"License"); you may not use this file except in compliance
|
|
67
|
+
with the License. You may obtain a copy of the License at
|
|
68
|
+
|
|
69
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
+
|
|
71
|
+
.. Unless required by applicable law or agreed to in writing,
|
|
72
|
+
software distributed under the License is distributed on an
|
|
73
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
74
|
+
KIND, either express or implied. See the License for the
|
|
75
|
+
specific language governing permissions and limitations
|
|
76
|
+
under the License.
|
|
77
|
+
|
|
78
|
+
.. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
|
|
79
|
+
|
|
80
|
+
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
81
|
+
``PROVIDER_README_TEMPLATE.rst.jinja2`` IN the ``dev/breeze/src/airflow_breeze/templates`` DIRECTORY
|
|
82
|
+
|
|
83
|
+
Package ``apache-airflow-providers-apache-arrow``
|
|
84
|
+
|
|
85
|
+
Release: ``0.1.0``
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
`Apache Arrow <https://arrow.apache.org/>`__ provider for Airflow. Offers ``AdbcHook``,
|
|
89
|
+
a general-purpose hook that connects to any database supported by an
|
|
90
|
+
`Arrow Database Connectivity (ADBC) <https://arrow.apache.org/adbc/>`__ driver
|
|
91
|
+
(PostgreSQL, SQLite, DuckDB, Snowflake, BigQuery, Flight SQL, and more) and transfers data
|
|
92
|
+
as columnar Arrow ``RecordBatch`` objects for efficient, zero-copy bulk loads.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Provider package
|
|
96
|
+
----------------
|
|
97
|
+
|
|
98
|
+
This is a provider package for ``apache.arrow`` provider. All classes for this provider package
|
|
99
|
+
are in ``airflow.providers.apache.arrow`` python package.
|
|
100
|
+
|
|
101
|
+
You can find package information and changelog for the provider
|
|
102
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-apache-arrow/0.1.0/>`_.
|
|
103
|
+
|
|
104
|
+
Installation
|
|
105
|
+
------------
|
|
106
|
+
|
|
107
|
+
You can install this package on top of an existing Airflow installation (see ``Requirements`` below
|
|
108
|
+
for the minimum Airflow version supported) via
|
|
109
|
+
``pip install apache-airflow-providers-apache-arrow``
|
|
110
|
+
|
|
111
|
+
The package supports the following python versions: 3.10,3.11,3.12,3.13,3.14
|
|
112
|
+
|
|
113
|
+
Requirements
|
|
114
|
+
------------
|
|
115
|
+
|
|
116
|
+
======================================= ======================================
|
|
117
|
+
PIP package Version required
|
|
118
|
+
======================================= ======================================
|
|
119
|
+
``apache-airflow`` ``>=2.11.0``
|
|
120
|
+
``apache-airflow-providers-common-sql`` ``>=1.28.2``
|
|
121
|
+
``adbc-driver-manager`` ``>=1.7.0``
|
|
122
|
+
``more-itertools`` ``>=9.0.0``
|
|
123
|
+
``pyarrow`` ``>=16.1.0; python_version < "3.13"``
|
|
124
|
+
``pyarrow`` ``>=18.0.0; python_version >= "3.13"``
|
|
125
|
+
======================================= ======================================
|
|
126
|
+
|
|
127
|
+
Optional dependencies
|
|
128
|
+
----------------------
|
|
129
|
+
|
|
130
|
+
============== =====================================================================================================================================================================
|
|
131
|
+
Extra Dependencies
|
|
132
|
+
============== =====================================================================================================================================================================
|
|
133
|
+
``sqlite`` ``adbc-driver-sqlite>=1.7.0``
|
|
134
|
+
``snowflake`` ``adbc-driver-snowflake>=1.7.0``
|
|
135
|
+
``bigquery`` ``adbc-driver-bigquery>=1.7.0``
|
|
136
|
+
``flightsql`` ``adbc-driver-flightsql>=1.7.0``
|
|
137
|
+
``postgresql`` ``adbc-driver-postgresql>=1.7.0``
|
|
138
|
+
``all`` ``adbc-driver-sqlite>=1.7.0``, ``adbc-driver-snowflake>=1.7.0``, ``adbc-driver-bigquery>=1.7.0``, ``adbc-driver-flightsql>=1.7.0``, ``adbc-driver-postgresql>=1.7.0``
|
|
139
|
+
============== =====================================================================================================================================================================
|
|
140
|
+
|
|
141
|
+
The changelog for the provider package can be found in the
|
|
142
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-apache-arrow/0.1.0/changelog.html>`_.
|
|
143
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
airflow/providers/apache/arrow/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
|
2
|
+
airflow/providers/apache/arrow/__init__.py,sha256=I3r0WmQo7yPS5PjFNt5cRoGTsLLcKogVQHkXv6rifo4,1501
|
|
3
|
+
airflow/providers/apache/arrow/get_provider_info.py,sha256=VDik4X4cT7CaF0OG0gQ5xQu-v_dMLdHvnw_3lZS0fgU,2604
|
|
4
|
+
airflow/providers/apache/arrow/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
5
|
+
airflow/providers/apache/arrow/hooks/adbc.py,sha256=wdscw0KPMg4i7WnCFR6XT0iSegikijnonNGrsKFpZVo,14010
|
|
6
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/entry_points.txt,sha256=fby937Xww5bnzR0C5B8O5UTZngcV1VKrQWbHMlv1jyk,108
|
|
7
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/licenses/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
|
8
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/licenses/NOTICE,sha256=_cWHznIoUSbLCY_KfmKqetlKlsoH0c2VBjmZjElAzuc,168
|
|
9
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/WHEEL,sha256=_yMHPaBV-s6fQMwUoo83NSdTCM3c8xXWFXRhqafN-7Y,81
|
|
10
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/METADATA,sha256=Q95LsOc5oc8pGCufTe5x3usjpOs2Sx_Dd5eU37Hqta4,6988
|
|
11
|
+
apache_airflow_providers_apache_arrow-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|