realrolfje/anonimatron

How to handle Data in the same column that should not be Anonymized

Closed this issue · 1 comments

Hi,

I quickly tried Anonimatron and ti looks very good. Works without much configuration for our MSSQL DB. Unfortunatelly I don't know how I can achieve following:
I have a Table "Details" that contains entries whose column "value" should be anonymized. But there are also rows, that contain a Field that should not be anonymized.

Field Value
Text very large text
Property PropertyId

In the example above I would write following config:

    <table name="Details">
    <column name="Value" type="STRING" />
  </table>

This gives me:

Field Value
Text 3fe5fdb9a67abc29
Property 3fd9f179ad5deed8

But what I want is:

Field Value
Text 3fe5fdb9a67abc29
Property PropertyId

I took a look into the Anonymizer interface and it does not seem that it receives the whole row. Maybe you can give me a hint whether this is possible

Hi Josef, Anonimatron has a feature for this called "Discriminators". If you run Anonimatron with the option -configexample you will get an example configuration which demonstrates almost all features you can configure. Part of the example configuration will look like this:

<table name="DISCRIMINATOR_DEMO_TABLE">
    <column name="CONTACTINFO" type="RANDOMDIGITS" size="-1"/>
    <discriminator columnname="CONTACTTYPE" value="email address">
        <column name="CONTACTINFO" type="EMAIL_ADDRESS" size="-1"/>
    </discriminator>
</table>

Note the discriminator tag. In the configuration example above, if the CONTACTTYPE column contains the value "email address", Anonimatron will anonymize the CONTACTINFO column, using the EMAIL_ADDRESS anonymizer type.

In your case, I guess you need something like this:

<table name="Details">
    <discriminator columnname="Field" value="Text">
        <column name="Value" type="STRING"/>
    </discriminator>
</table>

This should only anonymize rows where the column "Field" contains the value "Text", and it will anonymize the column "Value" with a random STRING.

Can you give that configuration a try?