[Python] Lambda acting as UDF unable to capture the correct event passed by Athena

Discussão em 'Python' iniciado por Stack, Julho 28, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to decrypt columns on the fly using an external function in Athena, using the below syntax:

    USING EXTERNAL FUNCTION decrypt_columns(col varchar)
    RETURNS varchar
    LAMBDA 'arn:aws:lambda:ap-south-1:<acc-id>:function:decrypt_columns'
    SELECT creation_date, last_update_time, decrypt_columns(id_encrypted)
    FROM "test_iceberg"."kms_encrypted_table";


    I have developed a Python Lambda function that was giving a lot of errors, so I thought of just looking at the event passed by Athena to Lambda, and it is as below:

    Event is {'@type': 'PingRequest', 'identity': {'id': 'UNKNOWN', 'principal': 'UNKNOWN', 'account': '<acc-id>', 'arn': 'arn:aws:sts::<acc-id>:assumed-role/org-staging-aws-access/user@domain.com', 'tags': {}, 'groups': []}, 'catalogName': 'decrypt_columns', 'queryId': '1c530793-56e7-4f1f-8d38-50994de5d8edda'}


    So how do I pass the actual encrypted data to the Lambda function via Athena? I have written and tested the decryption code, and it is working fine as expected.

    Continue reading...

Compartilhe esta Página