Key generators
Syntho's Primary Key (PK) and Foreign Key (FK) generation methods are designed to enhance data privacy, integrity, and uniqueness across various tables. These methods generate unique hash values that mimic input data formats, ensuring referential integrity and maintaining the data structure.
Syntho offers three key generators to handle various scenarios for managing and transforming primary and foreign keys. Below are the descriptions and recommended use cases for Duplicate, Generate, and Hash.
1. Duplicate
Duplicate copies the original key values exactly as they appear in the source data, preserving both the correlations and referential integrity between primary and foreign keys.
When to use: Use Duplicate when it’s essential to maintain the original key values and relationships, particularly in de-identification scenarios where the data structure must be preserved without generating new keys.
Less recommended for: Upsampling is not supported when using Duplicate, as the original keys are simply copied, not expanded. Additionally, it is not recommended when the keys are sensitive and need to be protected, as this method retains the original key values without obfuscation.
2. Generate
Generate creates new, synthetic key values that do not correspond to the original keys. It preserves only the referential integrity, but not the correlations between key columns.
When to use: Use Generate for upsampling or creating synthetic datasets where there is no need to maintain relationships with the original data. It can also be used when creating data from scratch.
Less recommended for: The Generate function creates new keys independently of the original key order, which disrupts correlations. As a result, it is unsuitable for scenarios where maintaining the correlations and order is essential.
3. Hash
Hash converts original key values into hashed representations. Both correlations between tables and relational integrity are maintained.
When to use: Use Hash when you need to obscure the original key values, while ensuring correlations and referential integrity are preserved.
Less recommended for: Upsampling, or situations where the original key values must be maintained for direct referencing, such as cases where exact key values are essential for business logic (e.g. country codes) or traceability in audit scenarios.
How to Apply PK / FK Generators
On Column Level
Syntho beta feature
Go to Column settings > Generation Method, and select one of the available methods: Duplicate, Generate or Hash.
On Workspace Level
Setting a key column at the column level overrides the workspace's default key generation method. For example, if "Hash" is the default key generation method but "Duplicate" is set on the column level for "key_column," then "key_column" will use "Duplicate."
Use the shortcut
CTRL + SHIFT + ALT + 0
to open Workspace Default Settings and change the key generation method according to your choice by simply replacing the value to either "duplicate", "generate" or "hash" . Please note that it will apply the generator across the entire workspace.Alternatively, you can add /global_settings to the end of the workspace URL to open Workspace Default Settings.
On Composite Keys
The generator supports composite keys and ensures consistency across all columns that form the composite key.
Setting one composite key column to use a generation method automatically sets the other composite key columns to the same method as well in UI. Attempting to change the generation method for one composite key column (e.g., from "hash" to "duplicate" or "generate") will result in all composite key columns being reset to the same generation method. The UI shows linked key generation methods, but the destination database will have the correct independent generation methods applied.
Data Types
Textual Data:
Hash key values ensure unique and protected data while maintaining the original text structure.
Numeric Data:
Generation methods apply unique hashes to maintain numeric data privacy and integrity.
Date/Time Data:
Composite keys involving date/time fields will see all parts of the composite key aligned to the same generation method when hashes are applied.
The examples below shows two different composite keys. In the first image, the columns "Birthdate" and "First" are applied "generate" and "hash", respectively.
In the case below, the columns "Birthdate" and "Birthplace" are applied "hash" and "generate", respectively.
Limitations & Considerations
Composite foreign keys are not supported in the following situation:
when two or more columns that make up the composite foreign key also serve as a composite primary key in a referred other table, AND
the key generation method is set to generate
Generators are not applied to tables in Exclude mode.
Consistency is enabled (same input → same output) to preserve links between PK and FK columns.
Generation of keys for non-textual or highly complex data types, like images or large binary objects, is not supported.
Last updated