Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

Creating User-Defined Functions

You can create a custom user-defined scalar function (UDF) using either a SQL SELECT clause or a Python program. The new function is stored in the database and is available for any user with sufficient privileges to run, in much the same way as you run existing Amazon Redshift functions.

For Python UDFs, in addition to using the standard Python functionality, you can import your own custom Python modules. For more information, see Python Language Support for UDFs.

By default, all users can execute UDFs. For more information about privileges, see UDF Security and Privileges.