Why is database migration testing important when moving data from one system to another?
Think about what could go wrong with the data itself during migration.
Database migration testing focuses on verifying data integrity and correctness after moving data. It ensures no data is lost or corrupted.
Given the following SQL queries run before and after migration, what is the expected output if migration is successful?
-- Before migration SELECT COUNT(*) FROM customers; -- After migration SELECT COUNT(*) FROM customers_new;
Before migration count: 1500 After migration count: 1500
What does it mean if the row counts before and after migration match?
If the row counts are equal, it indicates that all data rows were migrated successfully without loss.
Which assertion correctly verifies that the 'email' field in the migrated 'users' table contains no NULL values?
assert migrated_data['email'].isnull().sum() == 0
Think about how to check that no NULL values exist in a column.
Checking that the sum of NULL values is zero confirms no NULLs are present in the 'email' column.
What error will this Python snippet raise during migration testing?
def test_row_count(original, migrated):
assert original.count == migrated.count
original = 1000
migrated = 1000
test_row_count(original, migrated)Check the data types and attributes used in the assertion.
The variables are integers and do not have a 'count' attribute, causing AttributeError.
Which approach is best for automating database migration testing to ensure data integrity and performance?
Think about thorough and repeatable testing methods.
Automated scripts that verify data and performance ensure consistent and reliable migration testing.