Skip to content

Conversation

@rhunwicks
Copy link
Contributor

No description provided.

@rhunwicks rhunwicks self-assigned this Oct 15, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves error handling in the metadata loading process by providing more detailed error messages when bulk operations fail. The changes enhance debugging capabilities by attempting individual instance saves when bulk operations fail and reporting specific instance data that caused the failure.

  • Enhanced error handling with fallback to individual instance saves when bulk operations fail
  • Added primary key handling to support individual instance updates
  • Improved error messages that include specific instance data and identifiers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

from io import BytesIO

import django
import numpy as np
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Consider importing numpy only when needed (e.g., from numpy import nan) since numpy is a heavy dependency and only used for np.nan replacement on line 144.

Copilot uses AI. Check for mistakes.
k: v for k, v in instance.__dict__.items() if k not in ["_state", "created", "modified"]
}
raise RuntimeError(
f"Failed to create/update {model_name} instance {i} {key} from:\n{json.dumps(instance, indent=4, ensure_ascii=False)}"
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The variable model_name is not defined in this scope. It should likely be model.__name__ or model._meta.model_name.

Copilot uses AI. Check for mistakes.
girum-air
girum-air previously approved these changes Oct 15, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rhunwicks rhunwicks merged commit 3d606bf into main Oct 15, 2025
13 checks passed
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.

3 participants