VERSION 0.4.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 AppSync. This function will take the input information, call AWS Athena, and respond to AWS AppSync with the results of the SQL call.
- DATABASE
The AWS Athena Database to query. May be overridden in the
query
request. Defaults todefault
- WORKGROUP
The AWS Athena Workgroup to use during queries. May be overridden in the
query
request. Defaults toprimary
.- MAX_CONCURRENT_QUERIES
The maximum number of concurrent queries allowed in BatchInvoke requests. Defaults to
5
.
- 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.
function.handler
Request:
{
"query": "select * from bar",
"params": {},
"database": "foo",
"workgroup": "myworkgroup",
"singleResult": boolean
}
- query: REQUIRED
This is the query string to be executed. It may be parameterized with PyFormat, using the new format {} named placeholders method.
- params: OPTIONAL
Required if your query 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.
- workgroup: OPTIONAL
The AWS Athena Workgroup to use during. Overrides WORKGROUP if present.
- singleResult: OPTIONAL
true if AppSync is expecting a single map result, false if multiple results (maps) in a list may be returned. Defaults to false.
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.) } ]
License: APL2