diff --git a/Fix-bad-error-check-causing-bulk-import-methods-to-fail.patch b/Fix-bad-error-check-causing-bulk-import-methods-to-fail.patch new file mode 100644 index 0000000000000000000000000000000000000000..322c14869ea75d003d5bc1ffa0ffa25bcdc31b4e --- /dev/null +++ b/Fix-bad-error-check-causing-bulk-import-methods-to-fail.patch @@ -0,0 +1,39 @@ +From a2f5ed4e1bc2ae313ac8105348dc75f1e2186787 Mon Sep 17 00:00:00 2001 +From: Charlie Unfricht +Date: Wed, 16 Jun 2021 17:05:46 -0400 +Subject: [PATCH] Fix bad error check causing bulk import methods to fail + +--- + pyArango/collection.py | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/pyArango/collection.py b/pyArango/collection.py +index 7ee2061..3340096 100644 +--- a/pyArango/collection.py ++++ b/pyArango/collection.py +@@ -748,10 +748,8 @@ def bulkImport_json(self, filename, onDuplicate="error", formatType="auto", **pa + data = f.read() + r = self.connection.session.post(url, params = params, data = data) + +- try: +- errorMessage = "At least: %d errors. The first one is: '%s'\n\n more in .data" % (len(data), data[0]["errorMessage"]) +- except KeyError: +- raise UpdateError(data['errorMessage'], data) ++ if r.status_code != 201: ++ raise UpdateError('Unable to bulk import JSON', r) + + def bulkImport_values(self, filename, onDuplicate="error", **params): + """bulk import from a file repecting arango's json format""" +@@ -763,10 +761,8 @@ def bulkImport_values(self, filename, onDuplicate="error", **params): + data = f.read() + r = self.connection.session.post(url, params = params, data = data) + +- try: +- errorMessage = "At least: %d errors. The first one is: '%s'\n\n more in .data" % (len(data), data[0]["errorMessage"]) +- except KeyError: +- raise UpdateError(data['errorMessage'], data) ++ if r.status_code != 201: ++ raise UpdateError('Unable to bulk import values', r) + + def truncate(self): + """deletes every document in the collection""" diff --git a/pyArango.spec b/pyArango.spec index a572c719e0a652d0efcb0171fc2458b7fb40d404..61ecfd5b3b0016b0b82b57585b30b3c0e78e7d19 100644 --- a/pyArango.spec +++ b/pyArango.spec @@ -2,7 +2,7 @@ Name: pyarango Version: 2.0.1 -Release: 2 +Release: 3 Summary: Python Driver for ArangoDB with built-in validation License: Apache-2.0 URL: https://github.com/ArangoDB-Community/pyArango @@ -10,6 +10,7 @@ Source0: https://files.pythonhosted.org/packages/9f/0e/e1b22ae0020ab9da9d4 BuildArch: noarch Patch0001: 0001-remove-unused-install-require.patch +Patch0002: Fix-bad-error-check-causing-bulk-import-methods-to-fail.patch BuildRequires: python3-setuptools python3-devel @@ -57,6 +58,10 @@ pyArango supports graphs, indexes and probably everything that arangodb can do. %changelog +* Mon Apr 21 2025 zhangliangpengkun - 2.0.1-3 +- DESC:Fix bad error check causing bulk import methods to fail + + * Tue Aug 2 2022 algorithmofdish - 2.0.1-2 - add build require:python3-devel to provide pythonXdist