Skip to content

fix: allow duplicate readback/config#44

Merged
shaikhhasib merged 1 commit intomainfrom
bugfix/pv-import
Mar 31, 2026
Merged

fix: allow duplicate readback/config#44
shaikhhasib merged 1 commit intomainfrom
bugfix/pv-import

Conversation

@shaikhhasib
Copy link
Copy Markdown
Collaborator

@shaikhhasib shaikhhasib commented Mar 16, 2026

Description

Allow duplicate readback_address and config_address while keeping setpoint_address unique.

Normalize blank optional addresses to NULL during PV creation/import.

Add bulk import pre-checks for duplicate/existing setpoints with batching to avoid Postgres parameter limits.

Add tests for blank optional addresses and duplicate readbacks.

Add migration to drop unique constraints on readback/config and keep non-unique indexes.

Motivation

CSV import of large datasets was failing with 500 errors due to uniqueness violations on optional address fields.
This change makes the uniqueness rules match the desired behavior (setpoint unique, readback/config allowed to repeat) and prevents hard DB errors during bulk import.

Where Has This Been Documented?

Code Comment

Screenshots

NA

Pre-merge checklist

  • Code works interactively
  • Code contains descriptive docstrings
  • New/changed functions and methods are covered in the test suite where possible
  • Test suite passes locally
  • Test suite passes on GitHub Actions

@shaikhhasib shaikhhasib requested a review from YektaY March 16, 2026 22:00
@YektaY YektaY linked an issue Mar 17, 2026 that may be closed by this pull request
@YektaY YektaY requested review from a team March 17, 2026 22:49
Copy link
Copy Markdown
Contributor

@shilorigins shilorigins left a comment

Choose a reason for hiding this comment

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

Please fix the pre-commit warnings locally and then re-push so the job completes successfully.

Copy link
Copy Markdown
Contributor

@zdomke zdomke 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 for me!
Tests pass locally, works locally, and code makes sense to me.

@shaikhhasib shaikhhasib merged commit 6eff162 into main Mar 31, 2026
2 checks passed
@shaikhhasib shaikhhasib deleted the bugfix/pv-import branch March 31, 2026 15:53
@zdomke zdomke mentioned this pull request Mar 31, 2026
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.

[BUG] - Importing consolidated.csv fails with 500 error

3 participants