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

"process_bson_stream" Does Not Construct Projection With Auto-Discovered Schema

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 0.5.1
    • Affects Version/s: None
    • Component/s: None
    • None

      The following code:

      from pymongoarrow.monkey import patch_all
      patch_all()
      
      from pymongoarrow.api import Schema
      schema = Schema({'_id': int, 'measure': float, 'status': pyarrow.string(), 'installed_on': datetime})
      
      df_a = col.aggregate_pandas_all([{'$match':{'status':'active'}}], schema=schema)
      df_a
      
      df_a = col.aggregate_pandas_all([{'$match':{'status':'active'}}])
      
      

      Raises this error:

      Traceback (most recent call last):
        File "/Users/julius/source.py", line 60, in <module>
          df_a = col.aggregate_pandas_all([{'$match':{'status':'active'}}])
        File "/Users/julius/Work/mongo-arrow/bindings/python/pymongoarrow/api.py", line 192, in aggregate_pandas_all
          return _arrow_to_pandas(aggregate_arrow_all(collection, pipeline, schema=schema, **kwargs))
        File "/Users/julius/Work/mongo-arrow/bindings/python/pymongoarrow/api.py", line 133, in aggregate_arrow_all
          pipeline.append({"$project": schema._get_projection()})
      AttributeError: 'NoneType' object has no attribute '_get_projection'
      

            Assignee:
            julius.park@mongodb.com Julius Park (Inactive)
            Reporter:
            julius.park@mongodb.com Julius Park (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: