QuiNovas / appsync-athena-resolver

AWS AppSync resolver that provides GraphQL access to Athena databases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

appsync-athena-resolver

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.

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.
MAX_CONCURRENT_QUERIES:The maximum number of concurrent queries allowed in BatchInvoke requests. Defaults to 5.

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:

{
    "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.)
  }
]

Lambda Package Location

https://s3.amazonaws.com/lambdalambdalambda-repo/quinovas/appsync-athena-resolver/appsync-athena-resolver-0.4.0.zip

License: APL2

About

AWS AppSync resolver that provides GraphQL access to Athena databases

License:Apache License 2.0


Languages

Language:Python 100.0%