Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4581

mongo-python-driver - PR #1745: PYTHON-4550 Add MongoClient.bulkWrite API

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 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?

      shruti-sridhar has created PR #1745: PYTHON-4550 Add MongoClient.bulkWrite API in mongo-python-driver

      Issue Text:

        1. Summary

      This PR implements the `MongoClient.bulkWrite` API described in this [spec](https://github.com/mongodb/specifications/blob/master/source/crud/bulk-write.md). This API allows users to perform insert, update, and delete operations against mixed namespaces and receive detailed results for each operation performed.

      This new API is distinct from `MongoCollection.bulkWrite` in that it supports writes across many namespaces, and it uses the `bulkWrite` server command rather than individual `insert`/`update`/`delete` server commands.

        1. Major Changes
          1. In `pymongo/asynchronous` and `pymongo/synchronous`:
      • `mongo_client.py`: contains the user-facing `bulk_write()` function
      • `client_bulk.py`: contains the `_AsyncClientBulk`/`_ClientBulk` class, which handles the internal details of parsing the input write models, sending batches of commands to the server, handling the response, and returning the result
          1. In `pymongo`:
      • `client_bulk_shared.py`: contains the `ClientBulkWriteException` class and a helper to merge results across batches
      • `message.py`: contains the `_ClientBulkWriteContext` class and associated functions to construct and send OP_MSG
      • the batch-splitting logic is in the function `_client_batched_op_msg_impl()`
      • the OP_MSG construction logic is in the function `_client_construct_op_msg()`
      • `operations.py`: contains the write model classes
      • `results.py`: contains the `ClientBulkWriteResult` class as well as individual write result classes
        1. Testing

      All the added JSON files in this PR are spec tests that were synced from [this commit](https://github.com/mongodb/specifications/commit/10919c92cb784e9730551841e57541bee2e1af93). The unified test runner `test/unified_format.py` contains the changes required for these spec tests to run.

      The prose tests from that commit are implemented in `test/asynchronous/test_client_bulk_write.py` and `test/test_client_bulk_write.py`.

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: