VarChar UDFs
This section provides a list of Varchar UDFs for the protect, unprotect, and reprotect operations.
Consider a Trino session where you impersonate a user using the –user parameter as shown in the following example.
./TrinoCLI --server localhost:8080 --catalog hive --schema default --user=<sample_user>
If you execute any UDF after impersonating a user, then the query execution happens for the impersonated user <sample_user>. This is a limitation of Trino.
ptyProtectStr()
This UDF protects the varchar values.
Signature:
ptyProtectStr(varchar input, varchar dataElement)
Parameters:
| Name | Type | Description |
|---|---|---|
input | VarChar | Specifies the varchar value to protect. |
dataElement | VarChar | Specifies the name of the data element to protect the varchar value. |
Returns:
This UDF returns the protected varchar value.
Example:
select ptyProtectStr('ProtegrityProt','Varchar_DE');
Supported Protection Methods:
| Function Name | Tokenization | Encryption | FPE | No Encryption | Masking | Monitoring |
| ptyProtectStr() |
| No | Yes | Yes | Yes | Yes |
ptyUnprotectStr()
This UDF unprotects the existing protected varchar value.
Signature:
ptyUnprotectStr(varchar input, varchar dataElement)
Parameters:
| Name | Type | Description |
|---|---|---|
input | VarChar | Specifies the protected varchar value to unprotect. |
dataElement | VarChar | Specifies the name of the data element to unprotect the varchar value. |
Returns:
This UDF returns the unprotected varchar value.
Example:
select ptyUnProtectStr(PtyProtectStr('ProtegrityProt','Varchar_DE'),'Varchar_DE');
Supported Protection Methods:
| Function Name | Tokenization | Encryption | FPE | No Encryption | Masking | Monitoring |
| ptyUnprotectStr() |
| No | Yes | Yes | Yes | Yes |
ptyReprotect() - Str
This UDF reprotects the varchar protected data, which was earlier protected using the ptyProtectStr UDF, with a different data element.
Signature:
ptyReprotect(varchar input, varchar oldDataElement, varchar newDataElement)
Parameters:
| Name | Type | Description |
|---|---|---|
input | VarChar | Specifies the varchar value to reprotect. |
oldDataElement | VarChar | Specifies the name of the data element that was initially used to protect the data. |
newDataElement | VarChar | Specifies the name of the new data element to reprotect the data. |
Returns:
This UDF returns the protected varchar value.
Example:
select ptyReprotect(PtyProtectStr('ProtegrityProt','Varchar_DE'),'Varchar_DE','new_Varchar_DE');
Supported Protection Methods:
| Function Name | Tokenization | Encryption | FPE | No Encryption | Masking | Monitoring |
| ptyReprotect() |
| No | Yes | Yes | Yes | Yes |
Feedback
Was this page helpful?