Class: AWS.Athena

Inherits:
AWS.Service show all
Identifier:
athena
API Version:
2017-05-18
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Sending a Request Using Athena

var athena = new AWS.Athena();
athena.batchGetNamedQuery(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the Athena object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var athena = new AWS.Athena({apiVersion: '2017-05-18'});

You can also set the API version globally in AWS.config.apiVersions using the athena service identifier:

AWS.config.apiVersions = {
  athena: '2017-05-18',
  // other service API versions
};

var athena = new AWS.Athena();

Version:

  • 2017-05-18

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.Athena(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a Athena object

var athena = new AWS.Athena({apiVersion: '2017-05-18'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.Athena.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.Athena.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Athena.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

batchGetNamedQuery(params = {}, callback) ⇒ AWS.Request

Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query ID strings. Use ListNamedQueries to get the list of named query IDs. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under UnprocessedNamedQueryId. Named queries are different from executed queries. Use BatchGetQueryExecution to get details about each unique query execution, and ListQueryExecutions to get a list of query execution IDs.

Service Reference:

Examples:

Calling the batchGetNamedQuery operation

var params = {
  NamedQueryIds: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
athena.batchGetNamedQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NamedQueryIds — (Array<String>)

      An array of query IDs.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NamedQueries — (Array<map>)

        Information about the named query IDs submitted.

        • Namerequired — (String)

          The plain-language name of the query.

        • Description — (String)

          A brief description of the query.

        • Databaserequired — (String)

          The database to which the query belongs.

        • QueryStringrequired — (String)

          The SQL query statements that comprise the query.

        • NamedQueryId — (String)

          The unique identifier of the query.

      • UnprocessedNamedQueryIds — (Array<map>)

        Information about provided query IDs.

        • NamedQueryId — (String)

          The unique identifier of the named query.

        • ErrorCode — (String)

          The error code returned when the processing request for the named query failed, if applicable.

        • ErrorMessage — (String)

          The error message returned when the processing request for the named query failed, if applicable.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

batchGetQueryExecution(params = {}, callback) ⇒ AWS.Request

Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. To get a list of query execution IDs, use ListQueryExecutions. Query executions are different from named (saved) queries. Use BatchGetNamedQuery to get details about named queries.

Service Reference:

Examples:

Calling the batchGetQueryExecution operation

var params = {
  QueryExecutionIds: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
athena.batchGetQueryExecution(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • QueryExecutionIds — (Array<String>)

      An array of query execution IDs.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • QueryExecutions — (Array<map>)

        Information about a query execution.

        • QueryExecutionId — (String)

          The unique identifier for each query execution.

        • Query — (String)

          The SQL query statements which the query execution ran.

        • ResultConfiguration — (map)

          The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results.

          • OutputLocationrequired — (String)

            The location in S3 where query results are stored.

          • EncryptionConfiguration — (map)

            If query results are encrypted in S3, indicates the S3 encryption option used (for example, SSE-KMS or CSE-KMS and key information.

            • EncryptionOptionrequired — (String)

              Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used.

              Possible values include:
              • "SSE_S3"
              • "SSE_KMS"
              • "CSE_KMS"
            • KmsKey — (String)

              For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID.

        • QueryExecutionContext — (map)

          The database in which the query execution occurred.

          • Database — (String)

            The name of the database.

        • Status — (map)

          The completion date, current state, submission time, and state change reason (if applicable) for the query execution.

          • State — (String)

            The state of query execution. SUBMITTED indicates that the query is queued for execution. RUNNING indicates that the query is scanning data and returning results. SUCCEEDED indicates that the query completed without error. FAILED indicates that the query experienced an error and did not complete processing. CANCELLED indicates that user input interrupted query execution.

            Possible values include:
            • "QUEUED"
            • "RUNNING"
            • "SUCCEEDED"
            • "FAILED"
            • "CANCELLED"
          • StateChangeReason — (String)

            Further detail about the status of the query.

          • SubmissionDateTime — (Date)

            The date and time that the query was submitted.

          • CompletionDateTime — (Date)

            The date and time that the query completed.

        • Statistics — (map)

          The amount of data scanned during the query execution and the amount of time that it took to execute.

          • EngineExecutionTimeInMillis — (Integer)

            The number of milliseconds that the query took to execute.

          • DataScannedInBytes — (Integer)

            The number of bytes in the data that was queried.

      • UnprocessedQueryExecutionIds — (Array<map>)

        Information about the query executions that failed to run.

        • QueryExecutionId — (String)

          The unique identifier of the query execution.

        • ErrorCode — (String)

          The error code returned when the query execution failed to process, if applicable.

        • ErrorMessage — (String)

          The error message returned when the query execution failed to process, if applicable.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createNamedQuery(params = {}, callback) ⇒ AWS.Request

Creates a named query.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the createNamedQuery operation

var params = {
  Database: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  QueryString: 'STRING_VALUE', /* required */
  ClientRequestToken: 'STRING_VALUE',
  Description: 'STRING_VALUE'
};
athena.createNamedQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The plain language name for the query.

    • Description — (String)

      A brief explanation of the query.

    • Database — (String)

      The database to which the query belongs.

    • QueryString — (String)

      The text of the query itself. In other words, all query statements.

    • ClientRequestToken — (String)

      A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another CreateNamedQuery request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString, an error is returned.

      This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.

      If a token is not provided, the SDK will use a version 4 UUID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NamedQueryId — (String)

        The unique ID of the query.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteNamedQuery(params = {}, callback) ⇒ AWS.Request

Deletes a named query.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the deleteNamedQuery operation

var params = {
  NamedQueryId: 'STRING_VALUE' /* required */
};
athena.deleteNamedQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NamedQueryId — (String)

      The unique ID of the query to delete.

      If a token is not provided, the SDK will use a version 4 UUID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getNamedQuery(params = {}, callback) ⇒ AWS.Request

Returns information about a single query.

Service Reference:

Examples:

Calling the getNamedQuery operation

var params = {
  NamedQueryId: 'STRING_VALUE' /* required */
};
athena.getNamedQuery(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NamedQueryId — (String)

      The unique ID of the query. Use ListNamedQueries to get query IDs.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NamedQuery — (map)

        Information about the query.

        • Namerequired — (String)

          The plain-language name of the query.

        • Description — (String)

          A brief description of the query.

        • Databaserequired — (String)

          The database to which the query belongs.

        • QueryStringrequired — (String)

          The SQL query statements that comprise the query.

        • NamedQueryId — (String)

          The unique identifier of the query.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getQueryExecution(params = {}, callback) ⇒ AWS.Request

Returns information about a single execution of a query. Each time a query executes, information about the query execution is saved with a unique ID.

Service Reference:

Examples:

Calling the getQueryExecution operation

var params = {
  QueryExecutionId: 'STRING_VALUE' /* required */
};
athena.getQueryExecution(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • QueryExecutionId — (String)

      The unique ID of the query execution.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • QueryExecution — (map)

        Information about the query execution.

        • QueryExecutionId — (String)

          The unique identifier for each query execution.

        • Query — (String)

          The SQL query statements which the query execution ran.

        • ResultConfiguration — (map)

          The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results.

          • OutputLocationrequired — (String)

            The location in S3 where query results are stored.

          • EncryptionConfiguration — (map)

            If query results are encrypted in S3, indicates the S3 encryption option used (for example, SSE-KMS or CSE-KMS and key information.

            • EncryptionOptionrequired — (String)

              Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used.

              Possible values include:
              • "SSE_S3"
              • "SSE_KMS"
              • "CSE_KMS"
            • KmsKey — (String)

              For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID.

        • QueryExecutionContext — (map)

          The database in which the query execution occurred.

          • Database — (String)

            The name of the database.

        • Status — (map)

          The completion date, current state, submission time, and state change reason (if applicable) for the query execution.

          • State — (String)

            The state of query execution. SUBMITTED indicates that the query is queued for execution. RUNNING indicates that the query is scanning data and returning results. SUCCEEDED indicates that the query completed without error. FAILED indicates that the query experienced an error and did not complete processing. CANCELLED indicates that user input interrupted query execution.

            Possible values include:
            • "QUEUED"
            • "RUNNING"
            • "SUCCEEDED"
            • "FAILED"
            • "CANCELLED"
          • StateChangeReason — (String)

            Further detail about the status of the query.

          • SubmissionDateTime — (Date)

            The date and time that the query was submitted.

          • CompletionDateTime — (Date)

            The date and time that the query completed.

        • Statistics — (map)

          The amount of data scanned during the query execution and the amount of time that it took to execute.

          • EngineExecutionTimeInMillis — (Integer)

            The number of milliseconds that the query took to execute.

          • DataScannedInBytes — (Integer)

            The number of bytes in the data that was queried.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getQueryResults(params = {}, callback) ⇒ AWS.Request

Returns the results of a single query execution specified by QueryExecutionId. This request does not execute the query but returns results. Use StartQueryExecution to run a query.

Service Reference:

Examples:

Calling the getQueryResults operation

var params = {
  QueryExecutionId: 'STRING_VALUE', /* required */
  MaxResults: 0,
  NextToken: 'STRING_VALUE'
};
athena.getQueryResults(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • QueryExecutionId — (String)

      The unique ID of the query execution.

    • NextToken — (String)

      The token that specifies where to start pagination if a previous request was truncated.

    • MaxResults — (Integer)

      The maximum number of results (rows) to return in this request.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResultSet — (map)

        The results of the query execution.

        • Rows — (Array<map>)

          The rows in the table.

          • Data — (Array<map>)

            The data that populates a row in a query result table.

            • VarCharValue — (String)

              The value of the datum.

        • ResultSetMetadata — (map)

          The metadata that describes the column structure and data types of a table of query results.

          • ColumnInfo — (Array<map>)

            Information about the columns in a query execution result.

            • CatalogName — (String)

              The catalog to which the query results belong.

            • SchemaName — (String)

              The schema name (database name) to which the query results belong.

            • TableName — (String)

              The table name for the query results.

            • Namerequired — (String)

              The name of the column.

            • Label — (String)

              A column label.

            • Typerequired — (String)

              The data type of the column.

            • Precision — (Integer)

              For DECIMAL data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.

            • Scale — (Integer)

              For DECIMAL data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.

            • Nullable — (String)

              Indicates the column's nullable status.

              Possible values include:
              • "NOT_NULL"
              • "NULLABLE"
              • "UNKNOWN"
            • CaseSensitive — (Boolean)

              Indicates whether values in the column are case-sensitive.

      • NextToken — (String)

        A token to be used by the next request if this request is truncated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listNamedQueries(params = {}, callback) ⇒ AWS.Request

Provides a list of all available query IDs.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the listNamedQueries operation

var params = {
  MaxResults: 0,
  NextToken: 'STRING_VALUE'
};
athena.listNamedQueries(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      The token that specifies where to start pagination if a previous request was truncated.

    • MaxResults — (Integer)

      The maximum number of queries to return in this request.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NamedQueryIds — (Array<String>)

        The list of unique query IDs.

      • NextToken — (String)

        A token to be used by the next request if this request is truncated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listQueryExecutions(params = {}, callback) ⇒ AWS.Request

Provides a list of all available query execution IDs.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the listQueryExecutions operation

var params = {
  MaxResults: 0,
  NextToken: 'STRING_VALUE'
};
athena.listQueryExecutions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      The token that specifies where to start pagination if a previous request was truncated.

    • MaxResults — (Integer)

      The maximum number of query executions to return in this request.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • QueryExecutionIds — (Array<String>)

        The unique IDs of each query execution as an array of strings.

      • NextToken — (String)

        A token to be used by the next request if this request is truncated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startQueryExecution(params = {}, callback) ⇒ AWS.Request

Runs (executes) the SQL query statements contained in the Query string.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the startQueryExecution operation

var params = {
  QueryString: 'STRING_VALUE', /* required */
  ResultConfiguration: { /* required */
    OutputLocation: 'STRING_VALUE', /* required */
    EncryptionConfiguration: {
      EncryptionOption: SSE_S3 | SSE_KMS | CSE_KMS, /* required */
      KmsKey: 'STRING_VALUE'
    }
  },
  ClientRequestToken: 'STRING_VALUE',
  QueryExecutionContext: {
    Database: 'STRING_VALUE'
  }
};
athena.startQueryExecution(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • QueryString — (String)

      The SQL query statements to be executed.

    • ClientRequestToken — (String)

      A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another StartQueryExecution request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString, an error is returned.

      This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.

      If a token is not provided, the SDK will use a version 4 UUID.
    • QueryExecutionContext — (map)

      The database within which the query executes.

      • Database — (String)

        The name of the database.

    • ResultConfiguration — (map)

      Specifies information about where and how to save the results of the query execution.

      • OutputLocationrequired — (String)

        The location in S3 where query results are stored.

      • EncryptionConfiguration — (map)

        If query results are encrypted in S3, indicates the S3 encryption option used (for example, SSE-KMS or CSE-KMS and key information.

        • EncryptionOptionrequired — (String)

          Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used.

          Possible values include:
          • "SSE_S3"
          • "SSE_KMS"
          • "CSE_KMS"
        • KmsKey — (String)

          For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • QueryExecutionId — (String)

        The unique ID of the query that ran as a result of this request.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

stopQueryExecution(params = {}, callback) ⇒ AWS.Request

Stops a query execution.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

Service Reference:

Examples:

Calling the stopQueryExecution operation

var params = {
  QueryExecutionId: 'STRING_VALUE' /* required */
};
athena.stopQueryExecution(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • QueryExecutionId — (String)

      The unique ID of the query execution to stop.

      If a token is not provided, the SDK will use a version 4 UUID.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.