Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collect errors on bulk operations #1541

Merged

Conversation

Ptosiek
Copy link
Contributor

@Ptosiek Ptosiek commented Feb 13, 2023

Problem

Errors during bulk operations are not returned to the user in dry_run mode. Instead the exception is caught and logged and user can proceed to real import (which fails).

An extra savepoint is also used to rollback the transaction on dry_run/errors, but we can used the current transaction block instead to achieve the same.

Solution

Make errors raised during bulk operation part of result.base_errors so they can be returned to the user.

Remove extra savepoint.

Acceptance Criteria

Tests were written + documentation updated.

drop useless savepoint use current transaction instead
@coveralls
Copy link

coveralls commented Feb 13, 2023

Coverage Status

Coverage: 100.0%. Remained the same when pulling 07b57f7 on Ptosiek:raise-errors-on-bulk into 1e5eb96 on django-import-export:main.

Copy link
Contributor

@matthewhegarty matthewhegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks - I suggest a couple of minor changes for backwards compatibility and style.

import_export/resources.py Outdated Show resolved Hide resolved
import_export/resources.py Outdated Show resolved Hide resolved
import_export/resources.py Outdated Show resolved Hide resolved
@matthewhegarty matthewhegarty merged commit 8e82596 into django-import-export:main Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants