Model

Rules

What is a Rule

A rule is a set of operations that outputs anonymized or synthesized data into new datasets, the same or different datasources (sinks).

A rule is comparable to a program or an algorithm.

Rules run in jobs.

How to create a new rule

Open the Rules area of the tap model and click Create. The New rule window has two parts:

  • General: the Name of the rule (required, "Rule name is required") and a Description of its purpose.
  • Default Options: the options the rule uses when it runs, described below.

Import Rule creates a rule from a file exported with Export rule.

Options

The Default Options of a rule are:

OptionValuesDefaultWhat it does
Concurrency1 or more1Number of entities streamed at the same time
Continue Streaming On FailcheckboxonIf an entity fails, the job goes on with the other entities. When off, the job stops at the first entity that fails
Retry On FailcheckboxoffRetries a failed write batch by splitting it in half, again and again, until the record that fails is isolated. Used by Postgres, MySQL, Oracle, MSSQL, Databricks and Salesforce sinks
Load OptionsTruncate, Drop, Append, Update, MergeTruncateWhat to do when the sink already has data (see below)
DeterminismRandom, DeterministicRandomRandom gives different results in every run. Deterministic gives the same results in every run of the rule
Seed1 to 99999990Number that initializes the random generator. Required with Deterministic and disabled with Random. Generate picks a random seed
Check foreign keysAuto, Do not check, Force checkAutoStored with the rule (see the note below)
Read batch recordsnumber of records32768Records read from the source in every cycle
Write batch recordsnumber of records32768Records written to the destination in every cycle
Stream contentData and metadata, Data only, Metadata onlyData and metadataWhat the job writes. Metadata only writes no records: a sink gets its tables (created, emptied or dropped as the Load Options say) and a dataset gets the description of its entities. Data only writes the records, and a dataset gets no description of its entities
Dictionarysee belowNo dictionaryReuses the values already masked in previous runs

Load Options:

ValueEffect on the sink
TruncateRemoves the data of the tables but keeps their DDL
DropDeletes both the data and the DDL
AppendAdds the output of the rule to the existing data
UpdateUpdates the rows that have the same primary key. New rows are not inserted
MergeUpdates the rows that have the same primary key and inserts the new ones

Update and Merge need a primary key in the entity; without one the entity fails with an error like "Cannot update/merge database without any defined primary keys".

Dictionary modes:

ModeValues are reused
No dictionaryNever
Reuse values on the same entity+fieldOnly in the same field of the same entity
Reuse values with the same label or same entity+fieldIn fields with the same label, or the same field of the same entity
Reuse values in every fieldIn any field

With a dictionary you can also check:

  • Cache dictionary (on by default): keeps a local cache of the dictionary for the project.
  • Store new transformations in the dictionary (on by default): saves the new values so later runs reuse them.
  • Overwrite existing dictionary (off by default): replaces the values already stored.

These checkboxes are disabled with No dictionary. For more information check the article on how to use dictionaries.

Check foreign keys is saved with the rule and with its jobs, but in this version the job does not use it. To keep child rows consistent with their parent rows, use Ensure Referential Integrity in Where, Limit, Read Query or Synthesize.

Ignore already anonymized values

Ignore already anonymized values protects data that was already anonymized when a rule runs again over the same tap. It is not a rule option: you choose it in each job that overwrites the tap, and only when a dictionary is used (the checkbox is disabled with No dictionary). It appears in:

WhereShown whenSection
New jobOverwrite current tap is selectedTransform options
New pipelineOverwrite tap is selectedTransform options

It is off by default and it is never taken from the rule. In any job that doesn't overwrite the tap it is always off, whatever value was saved.

When it is on, every value is first looked up in the dictionary:

 value read from the tap
   │
   ├── stored as an original value ───► replaced with its stored
   │                                     anonymized value
   │
   ├── stored as an anonymized value ──► kept as it is
   │                                     (already anonymized)
   │
   └── not in the dictionary ──────────► anonymized as usual

If all the non-empty fields of a row that use the dictionary are already anonymized, the row is skipped and not written, so it stays as it is in the tap. The job log shows a line per entity like customers: 120 values ignored, 40 rows skipped (already anonymized).

Before 2.0.0 this option was on by default in every rule with a dictionary. When you upgrade to 2.0.0, a migration turns it off in all rules, rule versions, pipelines and scheduled jobs that have not started yet. Jobs that already ran keep their options, so a restart behaves as before. If you need it, turn it on again in the job that overwrites the tap.

Actions

The rules list shows a Run button for each rule and an Actions menu with:

  • Export rule: downloads the rule as a .json file, which you can bring into another model with Import Rule.
  • Edit rule: edits the rule options described in the above section Options.
  • View operations: goes to the operations page of the rule.
  • View jobs: shows the jobs of the rule.
  • Delete: deletes the rule from the model, after asking "Are you sure you want to delete this rule?".

Run opens the New job panel with the rule already selected, From set to the tap and To set to New Dataset. You can change the destination to a sink, an existing dataset or Overwrite current tap.

The panel starts with the options of the rule, and you can change them for this run only:

  • Concurrency, Continue Streaming On Fail, Retry On Fail, Read batch size and Write batch size.
  • Target entities (the load mode, when the output goes to a sink) starts at the load mode of the rule. If the sink doesn't support it, the first mode it supports is used instead. Overwrite current tap always uses Update, and the job asks for confirmation ("Warning: DATA LOSS WILL OCCUR"). It is disabled when the tap doesn't allow overwrites.
  • Transform options: Determinism, Seed, Check foreign keys and Dictionary, plus Ignore already anonymized values when overwriting the tap.

Check your Pipelines before deleting a rule because the pipeline may become inconsistent if the rule is being used.

Operations list

After creating the rule, click on the name to enter into operations page. Add operation opens a grid with the operations you can add, divided into three areas. Each operation can be added once per rule; the operations already in the rule are shown as selected.

Query

Query Operations change how the data is read from the tap, as if it were a SQL query:

OperationDescription in the gridIn SQL
Include/ExcludeFilter which entities are streamedFROM
SelectSet which fields to streamSELECT field, ...
WhereFilter records by valueWHERE
Read QueryUse a custom SQL/no-sql query to extract data from the tapYour own query
OrderOrder in which records are streamedORDER BY
LimitReduce the number of records streamedLIMIT
RateThrottle the stream speed

Transform

Transform Operations change the data or the order in which it is processed:

OperationDescription in the grid
SequenceOrder in which entities are streamed
SynthesizePopulate entities with fake data
AnonymizeMask and obfuscate entities
TransformTransform records value through code
Schema UpdateModify the database schema

These transformations output anonymized or synthesized data into new datasets, the same or different datasources (sinks).

Output

Output Operations change the data written to the destination:

OperationDescription in the grid
MaxReduce the number of records written