Skip to main content

Privacera Platform master publication

Create and run Databricks UDF for encryption
:

Create Privacera encryption UDFs (User-Defined Functions) by running SQL queries in the Databricks cluster:

  • SQL query to create Privacera protect UDF:

create database if not exists privacera;
drop function if exists privacera.protect;
CREATE FUNCTION privacera.protect AS 'com.privacera.crypto.PrivaceraEncryptUDF';
  • SQL query to create privacera unprotect UDF.

create database if not exists privacera;
drop function if exists privacera.unprotect;
CREATE FUNCTION privacera.unprotect AS 'com.privacera.crypto.PrivaceraDecryptUDF'; 
Run Sample Queries To Verify

Sample query to run encryption:

select privacera.protect($<colname>,'$<SCHEME_NAME>') from $<db_name>.$<table_name> limit10;

Sample query to run encryption and decryption in a single query to verify the setup:

select privacera.unprotect(privacera.protect($<colname>,'$<SCHEME_NAME>'),'$<SCHEME_NAME>') from $<db_name>.$<table_name> limit10;