Generators on primary key columns are different from normal generators in two ways:
The generated data has to be unique in order to not break constraints
The generators are consistent (same input → same output) so that when this generator is applied to a primary key column and its linked foreign key columns, no links are broken.
This is accomplished using format preserving encryption. For more information on this and details on how to provide your own encryption key, please contact [email protected].
Primary key generators are applied just like normal generators, by clicking the down chevron on the column:
Tonic then automatically applies this generator to all foreign key columns that reference this primary key as defined by the source schema and/or the Foreign Key Relationships JSON uploaded to the active Workspace.
As of V101 primary key generators support the following types:
Note that the ASCII Key Generator will not preserve format as it uses the ASCII alphabet for input and the alphanumeric alphabet for output leading to outputs that are longer than the inputs.
If you need support for additional types, please contact [email protected].
Note: Primary key generators are not currently supported in synthesized mode. This is because the synthesis process requires control over the key columns to make sure all relationships are maintained. This also means that you cannot have a primary key generator on a table that relates to a synthesized table through a foreign key.