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 OverflowAWS
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.
Videos
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
Starred by 244 users
Forked by 73 users
Languages PLpgSQL 87.6% | Shell 10.9%
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.
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%
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
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
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 ...