Registry / data / arrow-odbc

arrow-odbc

JSON →
library10.4.1pypypi✓ verified 83d ago

arrow-odbc is a Python library that enables efficient reading of data from any ODBC data source directly into Apache Arrow record batches. Built with Rust, it provides a high-performance bridge between relational databases accessible via ODBC and Python's data analysis ecosystem. As of version 10.1.0, it offers robust capabilities for data ingestion into Arrow, supporting various data types and large datasets. It generally follows a regular release cadence, with major versions often introducing significant features or breaking changes.

pip install arrow-odbc
INSTALL
IMPORT
SIG · ARROW-ODBC
A
arrow-odbc
datapythonv10.4.1
Install
3.7s avg
Import
Disk
171MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v10.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.7s · import 0.000s · 174MB
171MB installed
● package 171MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

read_arrow_batches_from_odbc
from arrow_odbc import read_arrow_batches_from_odbc
from arrow_odbc import read_arrow_tables
connect
from arrow_odbc import connect
Connection
from arrow_odbc import Connection

This quickstart demonstrates how to connect to an ODBC data source and retrieve data as an Apache Arrow Table using `arrow-odbc`. It highlights the `read_arrow_tables` function, which is the primary entry point for data retrieval. Users must replace the example connection string and query with their specific database details and ensure the appropriate ODBC driver is installed on their system.

import os from arrow_odbc import read_arrow_tables import pyarrow.parquet as pq # NOTE: You must have an ODBC driver installed on your system # for the target database (e.g., SQL Server, PostgreSQL, MySQL). # The connection string below is an example. Adjust it for your setup. # Example connection strings: # SQL Server (Windows/Linux): DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=testdb;UID=user;PWD=password # PostgreSQL (Linux): DRIVER={PostgreSQL Unicode};SERVER=localhost;DATABASE=testdb;UID=user;PASSWORD=password connection_string = os.environ.get( 'ARROW_ODBC_CONNECTION_STRING', 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=testdb;UID=user;PWD=password' ) # Example query. Adjust 'YourTable' and syntax for your database. # For SQL Server: "SELECT TOP 100 * FROM YourTable" # For PostgreSQL: "SELECT * FROM YourTable LIMIT 100" query = "SELECT TOP 100 * FROM YourTable" try: # Read data into a PyArrow Table arrow_table = read_arrow_tables( connection_string=connection_string, query=query ) print(f"Successfully read {arrow_table.num_rows} rows.") print(f"Schema:\n{arrow_table.schema}") if arrow_table.num_rows > 0: print(f"First 5 rows:\n{arrow_table.slice(0, min(5, arrow_table.num_rows)).to_pylist()}") # Example: Save to Parquet # pq.write_table(arrow_table, "output.parquet") except Exception as e: print(f"An error occurred: {e}") print("Please ensure your ODBC driver is installed and the connection string/query are correct.")
Debug
Known issues
breakingThe primary data retrieval function `read_all_tables` was renamed to `read_arrow_tables` in version 10.0.0. Older code using `read_all_tables` will fail after upgrading.
fix
Update calls from `read_all_tables(...)` to `read_arrow_tables(...)`.
affects: >=10.0.0
gotchaInstallation of the appropriate ODBC driver for your specific database and operating system is a prerequisite and is handled outside of Python. `arrow-odbc` relies on a correctly configured ODBC environment.
fix
Consult your database vendor's documentation for instructions on installing and configuring the necessary ODBC driver (e.g., `unixodbc-dev` and `msodbcsql17` for SQL Server on Linux).
affects: all
gotchaODBC connection string syntax is highly specific to the ODBC driver and database being used. Incorrectly formatted connection strings are a common source of connection errors.
fix
Verify the connection string format against your specific ODBC driver's documentation and database requirements. Pay close attention to driver name, server address, database name, and credentials.
affects: all
gotchaWhen querying large datasets, the resulting Apache Arrow Table can consume significant amounts of memory, potentially leading to out-of-memory errors if not managed carefully.
fix
For very large datasets, consider fetching data in smaller chunks using `LIMIT`/`OFFSET` in your SQL query, or leverage the `chunk_size_in_rows` and `max_chunks_in_flight` parameters in `read_arrow_tables` if available (check current documentation for `arrow-odbc`'s support for these). Alternatively, process the Arrow Table iteratively or save it to disk directly (e.g., Parquet).
affects: all
Upgrade
Version history
10.4.1latest on PyPI · released May 27, 2026
Audit
Dependencies
pyarrowrequiredRequired for creating and handling Apache Arrow tables and record batches.
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
arrow-odbc — pip install arrow-odbc · libregistry