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

Python UDF Data Types

Python UDFs can use any standard Amazon Redshift data type for the input arguments and the function's return value. In addition to the standard data types, UDFs support the data type ANYELEMENT, which Amazon Redshift automatically converts to a standard data type based on the arguments supplied at run time. Scalar UDFs can return a data type of ANYELEMENT. For more information, see ANYELEMENT Data Type.

During execution, Amazon Redshift converts the arguments from Amazon Redshift data types to Python data types for processing, and then converts the return value from the Python data type to the corresponding Amazon Redshift data type. For more information about Amazon Redshift data types, see Data Types.

The following table maps Amazon Redshift data types to Python data types.

Amazon Redshift Data Type Python Data Type

smallint

integer

bigint

short

long

int

decimal or numeric

decimal

double

real

float

boolean

bool

char

varchar

string

timestamp

datetime