Amazon AWS Athena
20 min
this connector allows turbine to execute queries on aws athena asset setup this integration authenticates with aws athena using the following input values requirements aws access key id a long term aws access key id with access to athena aws secret key id a long term secret access key associated with the above accesskey id region name the aws region role arn an arn of an aws iam role to assume this is optional external id an external id to use when assuming the role this is optional obtaining aws credentials to use this integration, you will need to have an aws account and obtain the necessary aws credentials you can obtain these credentials by following the steps below log in to your aws account and navigate to the iam console in the left navigation pane, click on the "users" tab and select the user for which you want to create credentials click on the "security credentials" tab, and then click on the "create access key" make sure to save the access key id and secret access key in a secure location, as you will not be able to see the secret access key again after this step if you want to use an aws iam role, you will need to have the arn of the role and an optional external id, if one was specified by the aws account administrator configurations asset authenticates using aws credentials configuration parameters parameter description type required aws access key id a specific long term aws access key id string required aws secret access key a specific long term aws secret access key string required region name the aws region where you want to create new connections string required role arn role arn string optional external id external id string optional aws session token session token string optional actions get query execution details returns information about a single execution of a query if you have access to the workgroup in which the query ran input argument name type required description queryexecutionid string required unique identifier output parameter type description queryexecution object output field queryexecution engineversion object output field engineversion effectiveengineversion string output field effectiveengineversion selectedengineversion string output field selectedengineversion query string output field query queryexecutioncontext object output field queryexecutioncontext queryexecutionid string unique identifier resultconfiguration object result of the operation outputlocation string output field outputlocation resultreuseconfiguration object result of the operation resultreusebyageconfiguration object result of the operation enabled boolean output field enabled statementtype string type of the resource statistics object output field statistics datascannedinbytes number response data engineexecutiontimeinmillis number output field engineexecutiontimeinmillis queryplanningtimeinmillis number output field queryplanningtimeinmillis queryqueuetimeinmillis number output field queryqueuetimeinmillis resultreuseinformation object result of the operation reusedpreviousresult boolean result of the operation serviceprocessingtimeinmillis number output field serviceprocessingtimeinmillis totalexecutiontimeinmillis number output field totalexecutiontimeinmillis status object status value completiondatetime string time value state string output field state example \[ { "queryexecution" { "engineversion" {}, "query" "select from \\"amazon security lake glue db us east 1\\" \\"amazon security lake tab ", "queryexecutioncontext" {}, "queryexecutionid" "777fd206 3500 4e05 8d8a ab46e13b44e3", "resultconfiguration" {}, "resultreuseconfiguration" {}, "statementtype" "dml", "statistics" {}, "status" {}, "substatementtype" "select", "workgroup" "primary" }, "responsemetadata" { "httpheaders" {}, "httpstatuscode" 200, "requestid" "52488e2c ca7f 483e b167 88cdfdd88124", "retryattempts" 0 } } ] get query results get results of a single query execution specified by queryexecutionid from the athena query results location in amazon s3 input argument name type required description queryexecutionid string required the unique id of the query execution nexttoken string optional a token generated by the athena service that specifies where to continue pagination if a previous request was truncated to obtain the next set of pages, pass in the nexttoken from the response object of the previous page call maxresults number optional the maximum number of results (rows) to return in this request output parameter type description responsemetadata object response data httpheaders object http headers for the request connection string output field connection content length string response content content type string type of the resource date string date value x amzn requestid string unique identifier httpstatuscode number status value requestid string unique identifier retryattempts number output field retryattempts resultset object result of the operation resultsetmetadata object response data columninfo array output field columninfo rows array output field rows updatecount number count value nexttoken string output field nexttoken example \[ { "responsemetadata" { "httpheaders" {}, "httpstatuscode" 200, "requestid" "515cc1d7 ce9b 4679 97de beefcfb5bd75", "retryattempts" 0 }, "resultset" { "resultsetmetadata" {}, "rows" \[] }, "updatecount" 0 } ] list query executions get a list of available query execution ids for the queries in the specified workgroup input argument name type required description workgroup string optional the name of the workgroup from which queries are being returned if a workgroup is not specified, a list of available query execution ids for the queries in the primary workgroup is returned nexttoken string optional a token generated by the athena service that specifies where to continue pagination if a previous request was truncated to obtain the next set of pages, pass in the nexttoken from the response object of the previous page call maxresults number optional the maximum number of query executions to return in this request output parameter type description queryexecutionids array unique identifier responsemetadata object response data httpheaders object http headers for the request connection string output field connection content length string response content content type string type of the resource date string date value x amzn requestid string unique identifier httpstatuscode number status value requestid string unique identifier retryattempts number output field retryattempts nexttoken string output field nexttoken example \[ { "queryexecutionids" \[ "aab18033 4d65 44b2 ad5c 5f8997d33a53", "88998526 fff7 41d7 b113 9734dda00e65", "777fd206 3500 4e05 8d8a ab46e13b44e3" ], "responsemetadata" { "httpheaders" {}, "httpstatuscode" 200, "requestid" "7bce08ab 4013 44ba 8a75 051800fc243c", "retryattempts" 0 } } ] start query execution runs the sql query statements and returns an execution id input argument name type required description querystring string required the sql query statements to be executed clientrequesttoken string optional a unique case sensitive string used to ensure the request to create the query is idempotent (executes only once) this parameter is autopopulated if not provided queryexecutioncontext object optional the database within which the query executes database string optional the name of the database used in the query execution the database must exist in the catalog catalog string optional the name of the data catalog used in the query execution resultconfiguration object optional specifies information about where and how to save the results of the query execution outputlocation string optional the location in amazon s3 where your query and calculation results are stored, such as s3 //path/to/query/bucket/ encryptionconfiguration object optional if query and calculation results are encrypted in amazon s3, indicates the encryption option used (for example, sse kms or cse kms) and key information encryptionoption string optional parameter for start query execution kmskey string optional for sse kms and cse kms, this is the kms key arn or id expectedbucketowner string optional parameter for start query execution aclconfiguration object optional indicates that an amazon s3 canned acl should be set to control ownership of stored query results s3acloption string optional the amazon s3 canned acl that athena should specify when storing query results workgroup string optional the name of the workgroup in which the query is being started executionparameters array optional a list of values for the parameters in a query the values are applied sequentially to the parameters in the query in the order in which the parameters occur resultreuseconfiguration object optional specifies the query result reuse behavior for the query resultreusebyageconfiguration object optional result of the operation enabled boolean optional parameter for start query execution maxageinminutes number optional parameter for start query execution output parameter type description queryexecutionid string unique identifier responsemetadata object response data httpheaders object http headers for the request connection string output field connection content length string response content content type string type of the resource date string date value x amzn requestid string unique identifier httpstatuscode number status value requestid string unique identifier retryattempts number output field retryattempts example \[ { "queryexecutionid" "a437228e bd40 460f 9d1b a3f6be415920", "responsemetadata" { "httpheaders" {}, "httpstatuscode" 200, "requestid" "3b906e8b 4f70 428b 9369 49f0fcc3a0fc", "retryattempts" 0 } } ] notes aws account and access keys https //docs aws amazon com/powershell/latest/userguide/pstools appendix sign up html boto3 athena documentation https //boto3 amazonaws com/v1/documentation/api/latest/reference/services/athena html#athena