Reputation: 1
I'm wondering if anyone can share an example of how they have utilized a redshift user-defined function to help them optimize a query or script.
In the Redshift documentation - https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_FUNCTION.html - the example is pretty basic and is probably more work to just write the function.
I feel like they could be useful when writing long scripts but I couldn't find any examples to spark inspiration!
Upvotes: 0
Views: 2054
Reputation: 11
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.
Upvotes: 1