I get this error sometimes, because another error (caused by a typo in a table name in my JSON config file) can happen between insert_fake_data and remove_fake_data, preventing remove_fake_data from running. In this case, I have to manually drop the "fake_user" table before I can run the anonymizer again.
def anonymize
insert_fake_data
@config['tables'].each do |table_name, columns|
querys = column_query(table_name, columns)
querys.each do |query|
@db.run query
end
end
remove_fake_data
end
The solution could be to either catch any errors happening between insert_fake_data and remove_fake_data (to allow remove_fake_data to run regardless of errors).
Or to use "create table if exists" when creating the "fake_user" table, to let the anonymizer continue even if the table already exists.
I get this error sometimes, because another error (caused by a typo in a table name in my JSON config file) can happen between
insert_fake_data
andremove_fake_data
, preventingremove_fake_data
from running. In this case, I have to manually drop the "fake_user" table before I can run the anonymizer again.The solution could be to either catch any errors happening between
insert_fake_data
andremove_fake_data
(to allowremove_fake_data
to run regardless of errors). Or to use "create table if exists" when creating the "fake_user" table, to let the anonymizer continue even if the table already exists.