{"record":{"id":"68db8fcc1946606f","repo":"pola-rs/polars","slug":"pyarrow-is-required-for-adbc-driver-manager-1-6","errorCode":null,"errorMessage":"pyarrow is required for adbc-driver-manager < 1.6.0, found {adbc_str_version}.\nEither upgrade `adbc-driver-manager` (suggested) or install `pyarrow`","messagePattern":"pyarrow is required for adbc-driver-manager < 1\\.6\\.0, found (.+?)\\.\nEither upgrade `adbc-driver-manager` \\(suggested\\) or install `pyarrow`","errorType":"exception","errorClass":"ModuleUpgradeRequiredError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/_utils.py","lineNumber":174,"sourceCode":"    )\n    if not dbapi_submodule:\n        return adbc_driver\n    # Importing the dbapi without pyarrow before adbc_driver_manager 1.6.0\n    # raises ImportError: PyArrow is required for the DBAPI-compatible interface\n    # Use importlib.import_module because Polars' import_optional clobbers this error\n    try:\n        adbc_driver_dbapi = import_module(f\"{module_name}.dbapi\")\n    except ImportError as e:\n        if \"PyArrow is required for the DBAPI-compatible interface\" in (str(e)):\n            adbc_driver_manager = import_optional(\"adbc_driver_manager\")\n            adbc_str_version = getattr(adbc_driver_manager, \"__version__\", \"0.0\")\n\n            msg = (\n                \"pyarrow is required for adbc-driver-manager < 1.6.0, found \"\n                f\"{adbc_str_version}.\\nEither upgrade `adbc-driver-manager` (suggested) or \"\n                \"install `pyarrow`\"\n            )\n            raise ModuleUpgradeRequiredError(msg) from None\n        # if the error message was something different, re-raise it\n        raise\n    else:\n        return adbc_driver_dbapi\n\n\ndef _open_adbc_connection(connection_uri: str) -> Any:\n    driver_name = _get_adbc_driver_name_from_uri(connection_uri)\n    module_name = _get_adbc_module_name_from_uri(connection_uri)\n    adbc_driver = _import_optional_adbc_driver(module_name)\n\n    # some backends require the driver name to be stripped from the URI\n    if driver_name in (\"duckdb\", \"snowflake\", \"sqlite\"):\n        connection_uri = re.sub(f\"^{driver_name}:/{{,3}}\", \"\", connection_uri)\n\n    return adbc_driver.connect(connection_uri)\n\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/database/_utils.py#L156-L192","documentation":"polars' `_import_optional_adbc_driver` wraps import of the adbc DBAPI module. If the import fails specifically because pyarrow is missing while adbc-driver-manager is < 1.6.0, polars raises ModuleUpgradeRequiredError telling you to upgrade adbc-driver-manager or install pyarrow. Other import errors are re-raised unchanged.","triggerScenarios":"Any call path that opens an adbc connection: `read_database_uri(..., engine=\"adbc\")`, `write_database(engine=\"adbc\")`, or `_open_adbc_connection`, with adbc-driver-manager < 1.6.0 and pyarrow absent.","commonSituations":"Fresh environments where pyarrow was never installed and adbc-driver-manager is old; dependency resolvers that dropped pyarrow; upgrading code to capsule-interface-only polars while keeping old adbc pins.","solutions":["Upgrade adbc-driver-manager to >= 1.6.0: `pip install -U adbc-driver-manager` (plus the driver package, e.g. adbc-driver-postgresql).","Install pyarrow: `pip install pyarrow`.","Pin pyarrow alongside adbc-driver-manager in requirements if you must keep adbc < 1.6.0."],"exampleFix":"// before (requirements.txt)\nadbc-driver-manager==1.2.0\n// after\nadbc-driver-manager>=1.6.0\n# or add: pyarrow","handlingStrategy":"validation","validationCode":"import importlib.metadata as md\nver = tuple(int(x) for x in md.version(\"adbc-driver-manager\").split(\".\")[:2])\nif ver < (1, 6, 0):\n    try:\n        import pyarrow  # noqa\n    except ImportError:\n        raise RuntimeError(\"install adbc-driver-manager>=1.6.0 or pyarrow\")","typeGuard":null,"tryCatchPattern":"from polars.io.database import ModuleUpgradeRequiredError\ntry:\n    df = pl.read_database_uri(q, uri, engine=\"adbc\")\nexcept ModuleUpgradeRequiredError:\n    # surface actionable install instructions to the operator\n    raise","preventionTips":["Install the full adbc stack together: adbc-driver-manager + the specific driver package","Prefer adbc-driver-manager>=1.6.0 so pyarrow becomes optional","Run a smoke-test import of the adbc connection in CI"],"tags":["polars","adbc","pyarrow","dependency-version","import-error"],"backgroundTag":"missing-dependency","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}