Skip to content

Commit e13abf5

Browse files
fix the counting of deleted items. Issue #897
1 parent 432624c commit e13abf5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

datajoint/table.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,9 @@ def delete_quick(self, get_count=False):
351351
def _delete_cascade(self):
352352
"""service function to perform cascading deletes recursively."""
353353
max_attempts = 50
354-
delete_count = 0
355354
for _ in range(max_attempts):
356355
try:
357-
delete_count += self.delete_quick(get_count=True)
356+
delete_count = self.delete_quick(get_count=True)
358357
except IntegrityError as error:
359358
match = foreign_key_error_regexp.match(error.args[0]).groupdict()
360359
if "`.`" not in match['child']: # if schema name missing, use self
@@ -383,7 +382,7 @@ def _delete_cascade(self):
383382
match['pk_attrs'])))
384383
else:
385384
child &= self.proj()
386-
delete_count += child._delete_cascade()
385+
child._delete_cascade()
387386
else:
388387
print("Deleting {count} rows from {table}".format(
389388
count=delete_count, table=self.full_table_name))

0 commit comments

Comments
 (0)