Skip to content

Generic Lambda function that can execute athena queries.

License

Notifications You must be signed in to change notification settings

QuiNovas/athena-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

athena-task

VERSION 0.1.0 IS A BREAKING CHANGE FROM PREVIOUS VERSIONS. PLEASE PAY PARTICULAR ATTENTION TO THE INFORMATION BELOW.

This is a generic Lambda task function that can execute athena queries. It is intended to be used in AWS StepFunctions. This function will take the input information, call AWS Athena, and respond to StepFunctions with the results of the SQL call.

Environment Variables

DATABASE:The AWS Athena Database to query. May be overridden in the query request. Defaults to default
WORKGROUP:The AWS Athena Workgroup to use during queries. May be overridden in the query request. Defaults to primary.

AWS Permissions Required

  • AmazonAthenaFullAccess arn:aws:iam::aws:policy/AmazonAthenaFullAccess

You will also require read access to the underlying AWS Athena datasource and access to any KMS keys used.

Handler Method

function.handler

Request Syntax

Request:

{
  "Operation": "string" | ["string"],
  "Parameters": {},
  "Database": "string",
  "SingleResult": boolean,
  "WorkGroup": "string"
}
Operation: REQUIRED
This is the query string to be executed. It may be parameterized with PyFormat, using the new format {} named placeholders method.
Parameters: OPTIONAL
Required if your Operation is parameterized. The keys in this map should correspond to the format names in your operation string or array.
Database: OPTIONAL
The schema/database name that you wish to query. Overrides DATABASE if present.
SingleResult: OPTIONAL
Defaults to true. Set to false to allow a list of results.
WorkGroup: OPTIONAL
The AWS Athena Workgroup to use during. Overrides WORKGROUP if present.

Response:

If SingleResult is true:

{
  "Key": Value,
  (Keys and values are generated from the query results.
  Keys are the column names, values are converted to their
  specified types.)
}

If SingleResult is false:

[
  {
    "Key": Value,
    (Keys and values are generated from the query results.
    Keys are the column names, values are converted to their
    specified types.)
  }
]

Lambda Package Location

https://s3.amazonaws.com/lambdalambdalambda-repo/quinovas/athena-task/athena-task-0.1.0.zip

License: APL2

About

Generic Lambda function that can execute athena queries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages