Uploaded image for project: 'Python Integrations'
  1. Python Integrations
  2. INTPYTHON-247

pymongoarrow does not work with pymongo >= 4.9

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.5.2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Via https://github.com/mongodb-labs/mongo-arrow/issues/233

      ```
      import pymongo
      import pymongoarrow

      print(pymongo._version, pymongoarrow.version_)

      from pymongoarrow.monkey import patch_all
      patch_all()
      ```

      works with:
      ```
      4.8.0 1.5.1
      ```

      fails with:
      ```
      4.9.1 1.5.1
      ```

      Exception
      ```
      ---------------------------------------------------------------------------
      ModuleNotFoundError                       Traceback (most recent call last)
      Cell In[1], line 7
            4 print(pymongo._version, pymongoarrow.version_)
            6 from pymongoarrow.monkey import patch_all
      ----> 7 patch_all()

      File [/opt/conda/lib/python3.11/site-packages/pymongoarrow/monkey.py:35](http://localhost:8888/opt/conda/lib/python3.11/site-packages/pymongoarrow/monkey.py#line=34), in patch_all()
           20 """Patch all PyMongoArrow methods into PyMongo.
           21 
           22 Calling this method equips the :class:`pymongo.collection.Collection`
         (...)
           31    df = coll.db.test.find_pandas_all({'amount': {'$gte': 20}}, schema=schema)
           32 """
           33 from pymongo.collection import Collection
      ---> 35 import pymongoarrow.api as api_module
           37 api_methods = api_module._PATCH_METHODS
           38 for method_name in api_methods:

      File [/opt/conda/lib/python3.11/site-packages/pymongoarrow/api.py:33](http://localhost:8888/opt/conda/lib/python3.11/site-packages/pymongoarrow/api.py#line=32)
           31 from pyarrow import Table, timestamp
           32 from pyarrow.types import is_date32, is_date64
      ---> 33 from pymongo.bulk import BulkWriteError
           34 from pymongo.common import MAX_WRITE_BATCH_SIZE
           36 from pymongoarrow.context import PyMongoArrowContext

      ModuleNotFoundError: No module named 'pymongo.bulk'
      ```

       

            Assignee:
            alex.clark@mongodb.com Alex Clark
            Reporter:
            alex.clark@mongodb.com Alex Clark
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: