I can share my project, a set of AWS Lambda based user defined functions (UDF) that allow one to do direct/reverse geocoding using SQL statements, delegating this task to the newly released Amazon Location Service. Check it out on:

https://github.com/aws-samples/amazon-redshift-location-user-defined-functions.

The project contain all the source code to setup the UDFs, the IAM roles, the AWS Lambdas in a CloudFormation template. You can even Launch it in your account clicking on the "Lauch Stack" button.

It's a completely functional sample, please check.

Answer from Fabio Oliveira on Stack Overflow
🌐
AWS
docs.aws.amazon.com › amazon redshift › database developer guide › user-defined functions in amazon redshift
User-defined functions in Amazon Redshift - Amazon Redshift
You can create a custom scalar user-defined 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. You run a custom scalar UDF in much the same way as you run existing Amazon ...
🌐
Dwgeek
dwgeek.com › home › redshift user defined functions examples
Redshift User Defined Functions Examples - DWgeek.com
February 22, 2023 - Above example demonstrate how to create user defined function and call it using SQL statement. The SELECT clause can’t include any of the following types of clauses in the statements: ... You can create the UDFs by calling other UDFs. Redshift does not track the dependency while creating UDF.
🌐
AWS
docs.aws.amazon.com › amazon redshift › database developer guide › sql reference › sql commands › create function
CREATE FUNCTION - Amazon Redshift
Amazon Redshift will no longer ... until June 30, 2026. For more information, see the blog post ... Creates a new scalar user-defined function (UDF) using either a SQL SELECT clause or a Python program....
🌐
GitHub
github.com › aws-samples › amazon-redshift-udfs
GitHub - aws-samples/amazon-redshift-udfs: A collection of example UDFs for Amazon Redshift. · GitHub
A collection of stored procedures and user-defined functions (UDFs) for Amazon Redshift.
Starred by 244 users
Forked by 73 users
Languages   PLpgSQL 87.6% | Shell 10.9%
🌐
BMC Software
bmc.com › blogs › amazon-redshift-udf-python
Creating Redshift User Defined Function (UDF) in Python – BMC Software | Blogs
You can create user defined functions in Amazon Redshift in Python. If you use Amazon Lambda containerless virtual machines, then you can use additional languages. (Using AWS Lambda, you will have some usage costs.
🌐
AWS
docs.aws.amazon.com › amazon redshift › database developer guide › user-defined functions in amazon redshift › use case examples for user-defined functions (udfs)
Use case examples for user-defined functions (UDFs) - Amazon Redshift
Existing Python UDFs will continue to function until June 30, 2026. Starting July 1, 2026, Amazon Redshift will no longer support Python UDFs. We recommend that you migrate your existing Python UDFs to Lambda UDFs before November 1, 2025. For information on creating and using Lambda UDFs, see Scalar Lambda UDFs. For information on converting existing Python UDFs to Lambda UDFs, see the blog post ... You can use user-defined ...
🌐
Trevor Fox
trevorfox.com › 2020 › 02 › intro-to-sql-udfs-in-redshift
Intro to SQL User-Defined Functions: A Redshift UDF Tutorial • Trevor Fox
March 19, 2023 - This is Redshift’s example from their docs. It takes two parameters (both specified as float) and returns the value that is greater of the two. create function f_sql_greater (float, float) returns float stable as $$ select case when $1 > $2 then $1 else $2 end $$ language sql; To refer to the different parameters in the function, you just use the dollar sign ($) and the order of the parameter in the function definition.
Find elsewhere
🌐
GitHub
github.com › aws-samples › amazon-redshift-location-user-defined-functions
GitHub - aws-samples/amazon-redshift-location-user-defined-functions: Amazon Redshift User Defined Functions to call Amazon Location Service APIs
This repository contain the code necessary to deploy Amazon Redshift Lambda-based User Defined Functions (UDF) to allow a user to call Amazon Location Service APIs, such as geocoding and reverse geocoding, as part of SQL queries.
Starred by 8 users
Forked by 4 users
Languages   Python 100.0% | Python 100.0%
🌐
Medium
medium.com › wunderlist-engineering › amazon-redshift-s-udf-b3d4205ae732
Amazon Redshift’s UDF
October 22, 2015 - Amazon Redshift’s UDF As you have probably heard, Amazon released User Defined Functions for Amazon Redshift and now you can write your own stored procedures in Python. I, myself, was looking …
🌐
YouTube
youtube.com › watch
Overview of Redshift and User Defined Function - YouTube
Session on 'Overview of Redshift and User Defined Function' by Jatin Goel, Amazon Authorized Instructor for re:SkillTake up the quiz for the session, earn po...
Published   December 20, 2022
🌐
Hevo
hevodata.com › home › learn › data warehousing
Fundamentals of Redshift Functions: Python UDF & SQL UDF with 2 Examples - Learn | Hevo
January 9, 2026 - When a Scalar Python UDF is called, it contains a Python Programme that executes and returns a single value. The Redshift function used here is CREATE FUNCTION, which creates a new scalar User-Defined Function (UDF).
🌐
AWS
aws.amazon.com › blogs › big-data › best-practices-for-amazon-redshift-lambda-user-defined-functions
Best practices for Amazon Redshift Lambda User-Defined Functions | Amazon Web Services
March 18, 2026 - While working with Lambda User-Defined Functions (UDFs) in Amazon Redshift, knowing best practices may help you streamline the respective feature development and reduce common performance bottlenecks and unnecessary costs. You wonder what programming language could improve your UDF performance, ...
🌐
AWS
aws.amazon.com › blogs › big-data › amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026
Amazon Redshift Python user-defined functions will reach end of support after June 30, 2026 | Amazon Web Services
June 30, 2025 - The Amazon Redshift integration with AWS Lambda provides the capability to create Amazon Redshift Lambda user-defined functions (UDFs). Because Lambda UDFs provide these significant advantages in integration, flexibility, scalability, and security, ...
🌐
AWS
docs.aws.amazon.com › amazon redshift › database developer guide › user-defined functions in amazon redshift › scalar sql udfs
Scalar SQL UDFs - Amazon Redshift
Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025. If you would like to use Python UDFs, create the UDFs prior to that date. Existing Python UDFs will continue to function as normal. For more information, see the blog post ... A scalar SQL UDF incorporates a SQL SELECT clause that runs when the function is called and returns a single value. The CREATE FUNCTION command defines ...
🌐
Aws-news
aws-news.com › article › 2025-06-30-amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026
Amazon Redshift Python user-defined functions will reach end of support after June 30, 2026
June 30, 2025 - Amazon Redshift will end support for Python user-defined functions (UDFs) after June 30, 2026, recommending migration to more flexible and scalable Lambda ...
🌐
Jithendray
jithendray.github.io › blog › Redshift---User-Defined-Functions
Redshift - User-Defined Functions
Redshift offers various inbuilt functions like sysdate or coalesce which can be executed whenever required. As the name suggestes, User-defined functions are the functions defined by a user to extend the inbuilt capabilities of RedshiftSQL.