Skip to content

fix: allow duplicate readback/config#44

Open
shaikhhasib wants to merge 1 commit intomainfrom
bugfix/pv-import
Open

fix: allow duplicate readback/config#44
shaikhhasib wants to merge 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
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

1 participant