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

Creating User-Defined Functions

You can create a custom user-defined scalar function (UDF) to implement non-SQL processing based on 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. 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.

To create a UDF, you must have USAGE privilege for the Python language. The UDF owner or a superuser can execute UDFs; other users must be granted privileges for each function. For more information about privileges, see UDF Security and Privileges.