ReOrc docs
Get ReOrc
English
English
  • About ReOrc
  • Set up and deployment
    • Set up organization
    • Install ReOrc agent
  • Getting started
    • 1. Set up a connection
      • BigQuery setup
    • 2. Create a project
    • 3. Create data models
    • 4. Build models in console
    • 5. Set up a pipeline
  • Connections
    • Destinations
      • Google Service Account
    • Integrations
      • Slack
  • Data modeling
    • Overview
    • Sources
    • Models
      • Model schema
      • Model configurations
    • Jinja templating
      • Variables
      • Macros
    • Materialization
    • Data lineage
    • Data tests
      • Built-in generic tests
      • Custom generic tests
      • Singular tests
  • Semantic modeling
    • Overview
    • Data Modelling vs Semantic Layer
    • Cube
      • Custom Dimension
      • Custom Measure
        • Aggregation Function
        • SQL functions and operators
        • Calculating Period-over-Period Changes
      • Relationship
    • View
      • Primary Dimension
      • Add Shared Fields
    • Shared Fields
    • Integration
      • Guandata Integration
      • Looker Studio
  • Pipeline
    • Overview
    • Modeling pipeline
    • Advanced pipeline
    • Job
  • Health tracking
    • Pipeline health
    • Data quality
  • Data governance
    • Data protection
  • Asset management
    • Console
    • Metadata
    • Version history
    • Packages and dependencies
  • DATA SERVICE
    • Overview
    • Create & edit Data Service
    • Data preview & download
    • Data sharing API
    • Access control
  • AI-powered
    • Rein AI Copilot
  • Settings
    • Organization settings
    • Project settings
    • Profile settings
    • Roles and permissions
  • Platform Specific
    • Doris/SelectDB
Powered by GitBook
On this page
  • Key management
  • Encrypt and decrypt data
  • In SQL
  • In Python
  1. Data governance

Data protection

PreviousData qualityNextConsole

Last updated 15 days ago

The Data Protection feature utilizes Data Encryption to ensure the confidentiality and integrity of data.

This process involves transforming readable data (plaintext) into an unreadable format (ciphertext) using advanced cryptographic algorithms and a secure encryption key. Only authorized parties with the corresponding decryption key can revert the data to its original form.

By encrypting data during storage, transmission, and processing, this feature protects sensitive information from unauthorized access, theft, and tampering.

Some of the use cases include:

  • Analytics querying: unless authorized, a user is not able to query privacy-sensitive data, even though they have all access to the database

  • Data querying: an authorized user can run a query to get the data, which reveals the privacy-sensitive data

  • Access control: the data owner can conveniently grant/revoke access to privacy-sensitive data

In the current version, ReOrc supports data encryption through:

  • Key management: Organization owners or admins can create encryption keys using symmetric cryptographic algorithms, AES-128 or AES-256.

  • Column-level encryption: Users can apply their database or data warehouse's built-in encryption and decryption functions with the created keys.

Key management

Only organization owners or admins can create and edit encryption keys.

To create an encryption key:

  1. Log in to your ReOrc organization.

  2. Navigate to Data Governance > Data Protection in the sidebar.

  3. Click Create key.

  4. Provide the following details:

    • Key name: This name must be unique and will be used in transformation scripts for encryption and decryption.

    • Description: Optional, but recommended.

    • Encryption algorithm: Choose between AES-128 and AES-256.

  5. Click Create.

AES-128 or AES-256

When choosing between AES-128 and AES-256 for database encryption, you should consider the tradeoff between performance and security:

  • AES-128: Faster encryption and decryption (~40% faster than AES-256), suitable for general use cases.

  • AES-256: Provides stronger security and a larger key space, ideal for highly sensitive data, such as financial records or government information.

Encrypt and decrypt data

ReOrc currently supports data encryption in advanced pipeline's operators only.

In SQL

-- Encrypt raw data using the secret key 'key_name'
SELECT AES_ENCRYPT(raw_column, {{ secret('key_name') }}) AS encrypted_data FROM my_table;

-- Decrypt data using the same key
SELECT AES_DECRYPT(encrypted_column, {{ secret('key_name') }}) AS decrypted_data FROM my_table;

In Python

class MyTransformer(Transformer):
    def transform_impl(self, row: dict, *args, **kwargs):
        row['phone_number_encrypted'] = aes_encrypt(row['phone_number'], 'key_name')
        return row

transformer = MyTransformer()

You can use the {{ secret('key_name') }} macro to reference your encryption key in SQL snippets. Use your database's encryption functions in a as follows:

You can use the aes_encrypt and aes_decrypt utility functions. For example, in a , we can encrypt column data before loading it into destination:

SQL opearator
Transfer operator