Skip to content

Add Apache Arrow provider - #52330

Open
dabla wants to merge 258 commits into
apache:mainfrom
dabla:feature/apache-arrow-provider
Open

Add Apache Arrow provider#52330
dabla wants to merge 258 commits into
apache:mainfrom
dabla:feature/apache-arrow-provider

Conversation

@dabla

@dabla dabla commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

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

AdbcHook

A general-purpose DbApiHook subclass that connects to any ADBC-compatible database via the
adbc-driver-manager. It exposes the full Airflow SQL hook surface (get_records, run,
insert_rows, …) while internally operating on Arrow RecordBatch objects for zero-copy,
columnar data transfer.

Key capabilities:

  • Arrow-native insertsinsert_rows converts rows to Arrow RecordBatch objects and
    uses the cursor's native bind API when available, falling back to executemany otherwise.
  • Chunked bulk loading — rows are committed in configurable chunks (commit_every) to
    bound transaction size and lock duration.
  • Dynamic driver discovery — the driver shared library is located automatically from the
    installed wheel; the entrypoint can also be overridden via connection extras.
  • Dialect-aware — SQL placeholder style is normalised per-dialect before execution.
  • Connection extrasdriver, entrypoint, db_kwargs, conn_kwargs, and dialect
    are all configurable from the Airflow connection UI without code changes.

Supported databases (via optional extras)

Extra Driver package
sqlite adbc-driver-sqlite
postgresql adbc-driver-postgresql
snowflake adbc-driver-snowflake
bigquery adbc-driver-bigquery
flightsql adbc-driver-flightsql

Installation

# Core provider only
pip install apache-airflow-providers-apache-arrow

# With a specific driver
pip install "apache-airflow-providers-apache-arrow[postgresql]"

# With all bundled drivers
pip install "apache-airflow-providers-apache-arrow[all]"

Requirements

  • apache-airflow >= 2.11.0
  • apache-airflow-providers-common-sql >= 1.28.2
  • adbc-driver-manager >= 1.7.0
  • pyarrow >= 16.1.0 (Python < 3.13) / >= 18.0.0 (Python ≥ 3.13)
  • more-itertools >= 9.0.0

Link 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.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@potiuk

potiuk commented Jun 27, 2025

Copy link
Copy Markdown
Member

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 :)

Comment thread providers/apache/arrow/docs/connections/adbc.rst Outdated
Comment thread providers/apache/arrow/README.rst
Comment thread providers/apache/arrow/README.rst
Comment thread providers/apache/arrow/pyproject.toml Outdated
Comment thread providers/apache/arrow/pyproject.toml Outdated
Comment thread providers/apache/arrow/src/airflow/providers/apache/arrow/hooks/adbc.py Outdated
Comment thread providers/apache/arrow/src/airflow/providers/apache/arrow/hooks/adbc.py Outdated
Comment thread providers/apache/arrow/src/airflow/providers/apache/arrow/hooks/adbc.py Outdated
Comment thread providers/apache/arrow/tests/unit/apache/arrow/hooks/test_adbc.py
@vikramkoka

Copy link
Copy Markdown
Contributor

As @potiuk mentioned, I believe this needs a devlist conversation first.
Looking forward to it

@potiuk

potiuk commented Jun 28, 2025

Copy link
Copy Markdown
Member

As @potiuk mentioned, I believe this needs a devlist conversation first. Looking forward to it

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.

@dabla
dabla force-pushed the feature/apache-arrow-provider branch from 62ed14d to 3b07cfd Compare August 14, 2026 10:29
Comment thread providers/apache/arrow/src/airflow/providers/apache/arrow/hooks/adbc.py Outdated
Comment thread providers/apache/arrow/docs/connections/adbc.rst
dabla and others added 6 commits August 22, 2026 15:40
…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>
Comment thread providers/apache/arrow/docs/connections/adbc.rst Outdated
Comment thread providers/apache/arrow/docs/connections/adbc.rst Outdated
Comment thread providers/apache/arrow/tests/unit/apache/arrow/hooks/test_adbc.py Outdated
Comment thread providers/apache/arrow/tests/system/apache/arrow/__init__.py
dabla and others added 5 commits August 23, 2026 10:08
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants