diff --git a/arango/collection.py b/arango/collection.py index 3aea6f81..aac97bb9 100644 --- a/arango/collection.py +++ b/arango/collection.py @@ -1992,12 +1992,17 @@ def import_bulk( IMPORTANT NOTE: this parameter may go through breaking changes in the future where the return type may not be a list of result objects anymore. Use it at your own risk, and avoid - depending on the return value if possible. + depending on the return value if possible. Cannot be used with + parameter **overwrite**. :type batch_size: int :return: Result of the bulk import. :rtype: dict | list[dict] :raise arango.exceptions.DocumentInsertError: If import fails. """ + if overwrite and batch_size is not None: + msg = "Cannot use parameter 'batch_size' if 'overwrite' is set to True" + raise ValueError(msg) + documents = [self._ensure_key_from_id(doc) for doc in documents] params: Params = {"type": "array", "collection": self.name} diff --git a/tests/test_document.py b/tests/test_document.py index 02c47bc4..d7db480a 100644 --- a/tests/test_document.py +++ b/tests/test_document.py @@ -1843,6 +1843,10 @@ def test_document_import_bulk(col, bad_col, docs): assert len(result) == 1 empty_collection(col) + # Test import bulk with overwrite and batch_size + with pytest.raises(ValueError): + col.import_bulk(docs, overwrite=True, batch_size=1) + # Test import bulk on_duplicate actions doc = docs[0] doc_key = doc["_key"]