User Defined Functions

User Defined Functions (UDF) in Amazon Athena allow users to invoke protect and unprotect operations on data using Athena SQL.

To use a UDF in Athena, you must declare the USING EXTERNAL FUNCTION clause before the SELECT statement in a SQL query. For example, the following query would perform an unprotect on first_name and last_name fields using the deName element policy:

USING EXTERNAL FUNCTION unprotect(val varchar, el varchar) RETURNS varchar      LAMBDA '<replace_with_athena_protect_function_name>:Production'
SELECT unprotect(first_name, 'deName'), unprotect(last_name, 'deName')
FROM customers;

Parent topic:Understanding Athena Objects


Last modified : January 21, 2026