Add Apache Arrow provider - #52330
Conversation
|
Just for anyone looking here - this is a draft for discussion between me, @dabla and @zeroshade - we will still need to start a DISCUSSION thread for the new provider - and we think Arrow and ADBC is a good addition. But we have to first discuss the approach :) |
|
As @potiuk mentioned, I believe this needs a devlist conversation first. |
Yep. This one is mostly to gather learnigs, get feedback from @zeroshade and see how we can turn it into a "convincing" devlist proposal - by showing some use cases and small POC of implementation and what it allows :). We'll experiment a bit with it and gather our thoughts and see what can come out of it. |
… depend on sqlalchemy anymore
…isting dialects as ADBC dialect doesn't make sense
…mary_keys as it won't work with ADBC
…t prepared statements through ADBC
62ed14d to
3b07cfd
Compare
3b07cfd to
ee35a88
Compare
…tocommit Reaching into the private _conn attribute of the DBAPI Connection wrapper was fragile and coupled to an internal implementation detail. The wrapper already exposes the underlying AdbcConnection via the public adbc_connection property, and AdbcConnection provides a dedicated set_autocommit(bool) method that maps directly to the ADBC C-level option — no raw string key needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Short names like "autocommit" raise NotSupportedError from the driver; only the full dotted names (e.g. "adbc.connection.autocommit") are accepted. The new parametrized test locks in that behaviour against the real SQLite driver so the hook docstring and connection docs cannot silently drift from reality. Also fix test_set_autocommit_applies_adbc_option to assert the new public API (adbc_connection.set_autocommit) rather than the private _conn.set_options path that was removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… of boolean The JSON example and reference table both showed a JSON boolean for the autocommit option, while the hook docstring and the integration test consistently use the string form. ADBC drivers expect string values for this option; the boolean happened to also work but was misleading and inconsistent with the rest of the documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adbc.connection.* options belong to the connection namespace and are passed to AdbcConnection via conn_kwargs, not to AdbcDatabase via db_kwargs. The ADBC DatabaseOptions standard only covers uri, username, and password; there is no database-level autocommit key. Autocommit at the connection level is already documented correctly in the conn_kwargs table below. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Specifying spec=Cursor and spec=dbapi.Connection catches typos and phantom attribute access that would silently succeed on an unspecced mock, making tests more accurate guards against regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tests/system/apache/arrow/ directory contained only an __init__.py. The example Dag exercises the full hook lifecycle: create table, bulk insert rows via insert_rows(), query them with get_records(), and drop the table — using an in-memory SQLite ADBC connection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MSSQL, PostgreSQL, and Oracle providers all have docs/operators.rst with exampleinclude blocks pointing at their system test DAGs. The ADBC provider now follows the same convention: the system test DAG gains [START]/[END] markers and a new operators.rst embeds the relevant snippet and links back to the connection docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apache Arrow provider (
apache-airflow-providers-apache-arrow)Adds a new Airflow provider backed by Apache Arrow and the
Arrow Database Connectivity (ADBC) standard.
What's included
AdbcHookA general-purpose
DbApiHooksubclass that connects to any ADBC-compatible database via theadbc-driver-manager. It exposes the full Airflow SQL hook surface (get_records,run,insert_rows, …) while internally operating on ArrowRecordBatchobjects for zero-copy,columnar data transfer.
Key capabilities:
insert_rowsconverts rows to ArrowRecordBatchobjects anduses the cursor's native
bindAPI when available, falling back toexecutemanyotherwise.commit_every) tobound transaction size and lock duration.
installed wheel; the entrypoint can also be overridden via connection extras.
driver,entrypoint,db_kwargs,conn_kwargs, anddialectare all configurable from the Airflow connection UI without code changes.
Supported databases (via optional extras)
sqliteadbc-driver-sqlitepostgresqladbc-driver-postgresqlsnowflakeadbc-driver-snowflakebigqueryadbc-driver-bigqueryflightsqladbc-driver-flightsqlInstallation
Requirements
apache-airflow >= 2.11.0apache-airflow-providers-common-sql >= 1.28.2adbc-driver-manager >= 1.7.0pyarrow >= 16.1.0(Python < 3.13) />= 18.0.0(Python ≥ 3.13)more-itertools >= 9.0.0Link to the discussion thread on the devlist: https://lists.apache.org/thread/v1nxnr5gocvzs12pknjxkw64mrtpg2o0
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.