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

Polars and pymongoarrow with embedded documents

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: pymongoarrow
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Via https://www.mongodb.com/community/forums/t/polars-and-pymongoarrow-with-embedded-documents/315534

       

      I have an aggregation that produces data that contains embedded documents as:

       

      {
        "_id":

      {     "$oid": "65816a666771a1d4de33eb68"   }

      ,
        "diet_included": [
         

      {       "label": "banana",       "_id": "62af112dbe66bc92f8ceabcb",       "type": "foodLabel",       "labelId": 46,       "optionCategoryIdsForConflicts": [         13200,         90020,         91020       ],       "foodLabel": "banana",       "categoriesNames": []     }

      ,
         

      {       "label": "carrot",       "_id": "62af113cbe66bc92f8ceac20",       "type": "foodLabel",       "labelId": 131,       "optionCategoryIdsForConflicts": [         18170,         91010       ],       "foodLabel": "carrot",       "categoriesNames": []     }

      ,
         

      {       "label": "eggplant",       "_id": "62af115cbe66bc92f8ceacd4",       "type": "foodLabel",       "labelId": 311,       "optionCategoryIdsForConflicts": [         18080,         61000,         90020       ],       "foodLabel": "eggplant",       "categoriesNames": []     }

        ],
        "matchedLabels": {
          "matchBased": [
           

      {         "name": "None"       }

      ,
           

      {         "name": "Pescatarian"       }

      ,
           

      {         "name": "L_Vit. A"       }

          ],
          "noMatchedMicro": [],
          "userIncludedFoodLabels": [
            "banana",
            "carrot",
            "eggplant"
          ]
        }
      }

      I can successfully extract the data using the pandas library 
      result = col.aggrerate(agg)
      df = pandas.DataFrame(result)

      However this doesnt work with polars.DataFrame or with pymongoarrow aggregate_polars_all.    

      This is more of an irritant than a show stopper, but it raises the concern that  perhaps polars a) isn't compatible with 3.11 or that pymongo is the cause

      So anyone gone too far on the bleeding edge?

            Assignee:
            casey.clements@mongodb.com Casey Clements
            Reporter:
            alex.clark@mongodb.com Alex Clark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None