DEV Community

ReyerSneller
ReyerSneller

Posted on

Help in creating the most simple Athena UDF

Hi, could someone please give me an example in using a very simple UDF. From that simple UDF I could make it a more complex one, but I just need a very simple start in returning a substring from a database field. I have 2 problems:

  1. How to define a correct UDF in my query. My query now is:
    USING EXTERNAL FUNCTION test(ID VARCHAR) RETURNS VARCHAR LAMBDA 'test'
    select test(ID) FROM "BibleLinkDynDB"."default"."bible_link_statistics" limit 10;
    ID is the database field.

  2. How to use the input from the UDF in the lambda function. Based on the lambda template my function looks like this:

Image description

I know this is not correct. I don't now how to get and process the input string because I think event is an object.

If someone could please give me a hint or a simple example, then this beginner would be very grateful.

kind regards Reyer

Top comments (1)

Collapse
 
cvargasgeo profile image
Cristian Vargas

Hi Reyer, in this Workshop explain step by step the process . catalog.us-east-1.prod.workshops.a...