#!/usr/bin/env python3 """Test migration of just d10 partition with consolidation debugging.""" import sys from src.migrator.full_migration import FullMigrator from src.utils.logger import setup_logger, get_logger from src.connectors.postgres_connector import PostgreSQLConnector setup_logger(__name__) logger = get_logger(__name__) print("\n" + "="*80) print("Testing ELABDATADISP migration for partition d10 with debugging") print("="*80 + "\n") # Clear the target table first print("Clearing target table...") with PostgreSQLConnector() as pg_conn: with pg_conn.connection.cursor() as cursor: cursor.execute("DELETE FROM elabdatadisp") pg_conn.connection.commit() print("Target table cleared.") # Now run migration print("\nStarting migration...") try: migrator = FullMigrator("ELABDATADISP") result = migrator.migrate(dry_run=False, resume=False) print(f"\nMigration result: {result} rows") except Exception as e: logger.error(f"Migration error: {e}", exc_info=True) print(f"Migration error: {e}") sys.exit(1) print("\n" + "="*80) print("Migration complete - check logs for [CONSOLIDATION DEBUG] messages") print("="*80 + "\n")