DivanteLtd / anonymizer

Universal tool to anonymize database. GDPR (General Data Protection Regulation) data protection act supporting tool.
https://www.linkedin.com/pulse/gdpr-quick-wins-software-developers-teams-piotr-karwatka
352 stars 57 forks source link

Table 'fake_user' already exists #8

Open apandichi opened 6 years ago

apandichi commented 6 years ago

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.

Warxcell commented 5 years ago

I have the same error, but even after manual DROP error still persists.