!19 Fix bad error check causing bulk import methods to fail
From: @zhang-liang-pengkun Reviewed-by: @chenwei_kernel Signed-off-by: @chenwei_kernel
This commit is contained in:
commit
0c4dd0e88f
@ -0,0 +1,39 @@
|
||||
From a2f5ed4e1bc2ae313ac8105348dc75f1e2186787 Mon Sep 17 00:00:00 2001
|
||||
From: Charlie Unfricht <dzcharlie@gmail.com>
|
||||
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 <this_exception>.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 <this_exception>.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"""
|
||||
@ -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 <zhangliangpengkun@xfusion.com> - 2.0.1-3
|
||||
- DESC:Fix bad error check causing bulk import methods to fail
|
||||
|
||||
|
||||
* Tue Aug 2 2022 algorithmofdish <hexiujun1@huawei.com> - 2.0.1-2
|
||||
- add build require:python3-devel to provide pythonXdist
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user