Configure Snowflake UDFs for Use in LiveRamp Clean Room
You can create SQL-based user-defined functions (UDFs) in Snowflake and use them in Question Builder without revealing the UDF's underlying code to your partners.
Note
To request this feature, contact your LiveRamp representative.
This feature only works in Snowflake clean rooms. It does not work for hybrid clean rooms. For information, see "Configure a Snowflake Pattern Data Connection".
To configure a Snowflake UDF for use in LiveRamp Clean Room, you'll need your organization's Snowflake credentials and the names of the UDF, its database, and its schema in Snowflake.
Overall Steps
This topic provides the following instructions for working with Snowflake UDFs in LiveRamp Clean Room.
In Snowflake, a user with Snowflake's ACCOUNTADMIN role creates a secure SQL-based UDF with appropriate usage privileges.
For information, see "Creating a UDF", "Granting Privileges for UDFs", and "Protecting Sensitive Information with Secure UDFs" in the Snowflake documentation.
In your LiveRamp Clean Room organization, connect the Snowflake UDF by adding a function.
In your clean room, configure the UDF for use.
In Question Builder, use the UDF as a macro (similar to how you'd indicate a dataset).
Use the question with the UDF as you would use any other question.
Add the UDF to Your Organization
To add a UDF to your LiveRamp Clean Room organization, you must first configure credentials for the associated Snowflake account in Data Management → Credentials. For information about connecting your Snowflake account, see "Add the Credentials" and "Configure a Snowflake Pattern Data Connection".
Once the UDF is verified for access, you can configure it for use in a clean room.
In your organization, go to Data Management → User Defined Functions.
Click
.The Add User-Defined Function dialog displays a set of fields.
Enter the values for your Snowflake account and its UDF:
Function Name: A name for this function that you want displayed in LiveRamp Clean Room
User-Defined Function Type: Select Snowflake User-Defined Function
Credentials: Select the credentials for the associated Snowflake account.
Database Name: Enter the name of the UDF's database as displayed in Snowflake.
Schema Name: Enter the name of the UDF's schema as displayed in Snowflake.
Function Name: Enter the name of the UDF as displayed on the UDF's details page in Snowflake. The name is typically capitalized and uses underscores instead of spaces.
Function Parameters: Enter the UDF's parameters using the same syntax specified in Snowflake (typically in parentheses after the name used to call the UDF and the datatype). For example, a UDF that is used to encode hashed emails might have the following parameters:
(hashed_emails STRING)
Function Return Type: The capitalized datatype that the UDF returns, such as
STRING
Function Language: SQL is the only supported option for Snowflake UDFs.
Click
.
Configure the UDF for Use in a Clean Room
Once your UDF is verified, you can make it available for use in particular Snowflake clean rooms. Successful verification is displayed in the Configuration Status column on the User-Defined Functions page.
Enter the Snowflake clean room where you want to use the UDF.
In the left-hand navigation, select User-Defined Functions.
Configure the UDF for use in this clean room.
Click
.
Creating or Modifying a Question with a UDF
Once you configure a UDF for use in a clean room, Question Builder displays it in the "Available Objects" panel under User-Defined Functions.
You can add UDFs to a new or existing question by creating a macro and selecting the UDF the way you would add a dataset. For more information, see "Create a Question" and "Add a Dataset".
When you add the macro that indicates a UDF, you must also reference the correct parameters. For example, to execute an encoding function, you might include @hash(@dataset.@hashed_emails) in Question Builder's SQL query editor.
You can then run reports for the question or provision it as you would other types of questions.