The problem is that the developer has altered the table and re-importing the test data would undo those changes. Editing the text file is impractical because of its size (500 MB gzipped). So I came up with this workaround which just slightly alters the SQL using sed so that it doesn’t try to drop or recreate the table. It comments out the DROP TABLE line, and creates the new table in the test database instead of the real database.

The sed command just creates the new table in the test database but imports all of the data into the real database where it would normally go. It was difficult to eliminate the whole CREATE TABLE statement, so I just had it create the table in the test database where it will never be used.