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 the relationships between primary and foreign keys. This ensures the key structure remains intact.

  • 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. This method is especially useful for databases with complex relationships across multiple tables.

  • Recommended for: Situations where the keys must remain unchanged and consistent with the original data, such as in de-identification processes.

  • Not 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 produces entirely new keys and does not preserve the order or relationships of the source data.

  • When to Use: Generate is ideal for upsampling or creating synthetic datasets where there is no need to maintain relationships with the original data. It can also be used when introducing new data into a system that doesn’t require relational integrity between tables.

  • Recommended for: Scenarios involving the creation of entirely new datasets or expanding existing datasets without needing to maintain the original key relationships.

  • Not Recommended For: De-identification cases, as Generate produces new keys independent of the original key order, making it unsuitable for situations where preserving the structure and order of the original data is important.

3. Hash

Hash converts original key values into hashed representations while preserving relationships across tables. The hashed values are obfuscated and irreversible, ensuring relational integrity is maintained.

  • When to Use: Use Hash when you need to obscure the original key values while still maintaining relationships between keys. This is particularly useful in de-identification scenarios, where obfuscation is required for privacy but the relational structure must remain intact.

  • Recommended for: The de-identification process where protecting the original keys is critical, but preserving the relationships between tables is necessary.

  • Not Recommended For: Situations where the original key values must be maintained for direct referencing, such as cases where exact key values are essential for business logic 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