pola-rs/polars · error · ModuleUpgradeRequiredError

pyarrow is required for adbc-driver-manager <

Error message

pyarrow is required for adbc-driver-manager < {adbc_version_no_pyarrow_required} when using parameterized queries (via `execute_options`), found {adbc_str_version}.
Either upgrade `adbc-driver-manager` (suggested) or install `pyarrow`

What it means

When using the adbc engine of read_database_uri with parameterized queries (`execute_options`), adbc-driver-manager older than the version that removed the pyarrow requirement needs pyarrow installed. If both conditions hold (old adbc + no pyarrow), polars raises ModuleUpgradeRequiredError explaining the two ways out.

Solutions

  1. Upgrade adbc-driver-manager: `pip install -U 'adbc-driver-manager>=1.6.0'` (suggested).
  2. Install pyarrow: `pip install pyarrow`.
  3. Drop `execute_options` and inline the parameters into the SQL query string.

Example fix

// before
pl.read_database_uri("SELECT * FROM t WHERE id = ?", uri, engine="adbc", execute_options={"parameters": [42]})
# raises: no pyarrow, old adbc
// after
# pip install -U 'adbc-driver-manager>=1.6.0'  (or: pip install pyarrow)
pl.read_database_uri("SELECT * FROM t WHERE id = ?", uri, engine="adbc", execute_options={"parameters": [42]})
Defensive patterns

Strategy: validation

Validate before calling

import importlib.metadata as md
ver = tuple(int(x) for x in md.version("adbc-driver-manager").split(".")[:2])
if ver < (1, 6, 0):
    try:
        import pyarrow  # noqa
    except ImportError:
        raise RuntimeError("need adbc-driver-manager>=1.6.0 or pyarrow for execute_options")

Try / catch

from polars.io.database import ModuleUpgradeRequiredError
try:
    df = pl.read_database_uri(q, uri, engine="adbc", execute_options=opts)
except ModuleUpgradeRequiredError:
    df = pl.read_database_uri(q.replace("?", str(param)), uri, engine="adbc")

Prevention

When it happens

Trigger: Calling `read_database_uri(query, uri, engine="adbc", execute_options={...})` where adbc-driver-manager < adbc_version_no_pyarrow_required and pyarrow is not installed.

Common situations: Lean installs that deliberately avoid pyarrow (using the Arrow PyCapsule interface) combined with an outdated adbc-driver-manager; CI images pinned to old adbc versions.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/0563b1121a89448c. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/io/database/_utils.py:109

    # adbc_driver_manager must be >= 1.7.0 to support passing Python sequences into
    # parameterised queries (via execute_options) without PyArrow installed
    adbc_version_no_pyarrow_required = "1.7.0"
    has_required_adbc_version = adbc_version >= parse_version(
        adbc_version_no_pyarrow_required
    )

    if (
        execute_options is not None
        and not _PYARROW_AVAILABLE
        and not has_required_adbc_version
    ):
        msg = (
            "pyarrow is required for adbc-driver-manager < "
            f"{adbc_version_no_pyarrow_required} when using parameterized queries (via "
            f"`execute_options`), found {adbc_str_version}.\nEither upgrade "
            "`adbc-driver-manager` (suggested) or install `pyarrow`"
        )
        raise ModuleUpgradeRequiredError(msg)

    # From adbc_driver_manager version 1.6.0 Cursor.fetch_arrow() was introduced,
    # returning an object implementing the Arrow PyCapsule interface. This should be
    # used regardless of whether PyArrow is available.
    fetch_method_name = (
        "fetch_arrow" if adbc_version >= (1, 6, 0) else "fetch_arrow_table"
    )

    from polars import DataFrame

    with _open_adbc_connection(connection_uri) as conn, conn.cursor() as cursor:
        cursor.execute(query, **(execute_options or {}))
        tbl = getattr(cursor, fetch_method_name)()
        return DataFrame(tbl, schema_overrides=schema_overrides)  # type: ignore[return-value]


def _get_adbc_driver_name_from_uri(connection_uri: str) -> str:
    driver_name = connection_uri.split(":", 1)[0].lower()

View on GitHub (pinned to fe841f959e)