From 3576a8f354625e45a872e591b66e7fa077a621d6 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 27 Dec 2025 09:45:15 +0100 Subject: [PATCH] fix: When --partition is specified, ignore migration_state partition tracking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: When using --partition to test a specific partition, the code would still read last_completed_partition from migration_state and skip partitions based on that, potentially skipping the requested partition. Solution: When partition parameter is specified, set last_completed_partition to None to force processing the requested partition regardless of what's in migration_state. This ensures --partition works as expected: - python3 main.py migrate full --table ELABDATADISP --partition d10 --resume Will process ONLY d10, not resume from migration_state partition tracking 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 --- src/migrator/full_migration.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/migrator/full_migration.py b/src/migrator/full_migration.py index 07f2c04..6f11054 100644 --- a/src/migrator/full_migration.py +++ b/src/migrator/full_migration.py @@ -71,7 +71,13 @@ class FullMigrator: # - Full restart requires clearing the table previous_migrated_count = self._get_previous_migrated_count(pg_conn, pg_table) - last_completed_partition = self._get_last_completed_partition(pg_conn, pg_table) + # If specific partition requested, ignore migration_state partition tracking + # and start fresh for that partition + if partition: + last_completed_partition = None + logger.info(f"Specific partition {partition} requested - ignoring migration_state partition tracking") + else: + last_completed_partition = self._get_last_completed_partition(pg_conn, pg_table) if previous_migrated_count > 0: pg_row_count = pg_conn.get_row_count(pg_table)