Registry / database / pymongoarrow

pymongoarrow

JSON →
library1.14.0pypypi✓ verified 87d ago

PyMongoArrow bridges MongoDB with NumPy, Pandas, Polars, and PyArrow. Version 1.13.0 adds parallel batch processing and Polars ExtensionTypes support. Released ~monthly.

pip install pymongoarrow
INSTALL
IMPORT
SIG · PYMONGOARROW
P
pymongoarrow
databasepythonv1.14.0
Install
6.8s avg
Import
368ms
Disk
254MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.14.0 · 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.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.8s · import 0.368s · 252MB
254MB installed
● package 254MB
Code
Verified usage

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

pymongoarrow
import pymongoarrow
pymongoarrow.api
from pymongoarrow.api import Schema

Basic usage: patch pymongo, define schema, query collections to get Arrow/Pandas/Polars outputs.

import os import pymongo from pymongoarrow.api import Schema from pymongoarrow.monkey import patch_all # Patch pymongo to enable arrow operations patch_all() client = pymongo.MongoClient(os.environ.get('MONGODB_URI', 'mongodb://localhost:27017')) db = client.test coll = db.mydata # Define schema (field name: type) schema = Schema({'name': str, 'age': int, 'city': str}) # Insert sample data coll.insert_many([ {'name': 'Alice', 'age': 30, 'city': 'NYC'}, {'name': 'Bob', 'age': 25, 'city': 'SF'}, ]) # Fetch as Arrow table import pyarrow as pa table = coll.find_arrow_all({}, schema=schema) print(table) # Convert to pandas df = coll.find_pandas_all({}, schema=schema) print(df) # Convert to polars import polars as pl pl_df = coll.find_polars_all({}, schema=schema) print(pl_df)
Debug
Known issues
breakingIn v1.11.0, Python 3.9 support was dropped and Python 3.13 free-threaded was dropped on some platforms. The TypeRegistry in write() now extends rather than replaces.
fix
Upgrade to Python >=3.10. If writing Arrow data, do not expect old TypeRegistry replacement behavior.
affects: >=1.11.0
deprecatedPyMongoArrow 1.13.0 is still using pymongo.monkey.patch_all() which may change in future versions.
fix
Monitor release notes for deprecation; consider using API directly with Schema and find_arrow_all.
affects: >=1.13.0
gotchaSchema inference may overflow for large integers (e.g., int64) if not explicitly defined. In v1.13.0, schema inference raises OverflowError for out-of-range values.
fix
Always define Schema explicitly for fields that may exceed inferred type range.
affects: >=1.13.0
gotchapandas is an optional dependency; if not installed, find_pandas_all() will raise ImportError.
fix
Install pymongoarrow[pandas] or pandas separately.
affects: >=1.10.0
Errors
Common errors & fixes
ImportError: cannot import name 'patch_all' from 'pymongoarrow'
Import path changed in older versions; patch_all is in pymongoarrow.monkey.
fix
Use: from pymongoarrow.monkey import patch_all
TypeError: 'Schema' object is not callable
Schema is not a function; it's a class that takes keyword arguments.
fix
Use: Schema({'field': type}) instead of Schema('field', type)
pymongo.errors.OperationFailure: unknown command: aggregation
MongoDB server version too old (<3.6) or missing aggregation support.
fix
Upgrade MongoDB to >=3.6 or use a different query method.
Upgrade
Version history
1.14.0latest on PyPI · released May 28, 2026
Audit
Dependencies
pymongorequiredMongoDB driver
pyarrowrequiredArrow data format
pandasoptionalDataFrame conversion
polarsoptionalDataFrame conversion
Agent activity
4 hits · last 30 days
node
4
Resources
pymongoarrow — pip install pymongoarrow · libregistry