You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Athena::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



152
153
154
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 152

def initialize(*args)
  super
end

Instance Method Details

#batch_get_named_query(params = {}) ⇒ Types::BatchGetNamedQueryOutput

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.

Examples:

Request syntax with placeholder values


resp = client.batch_get_named_query({
  named_query_ids: ["NamedQueryId"], # required
})

Response structure


resp.named_queries #=> Array
resp.named_queries[0].name #=> String
resp.named_queries[0].description #=> String
resp.named_queries[0].database #=> String
resp.named_queries[0].query_string #=> String
resp.named_queries[0].named_query_id #=> String
resp.unprocessed_named_query_ids #=> Array
resp.unprocessed_named_query_ids[0].named_query_id #=> String
resp.unprocessed_named_query_ids[0].error_code #=> String
resp.unprocessed_named_query_ids[0].error_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :named_query_ids (required, Array<String>)

    An array of query IDs.

Returns:

See Also:



199
200
201
202
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 199

def batch_get_named_query(params = {}, options = {})
  req = build_request(:batch_get_named_query, params)
  req.send_request(options)
end

#batch_get_query_execution(params = {}) ⇒ Types::BatchGetQueryExecutionOutput

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.

Examples:

Request syntax with placeholder values


resp = client.batch_get_query_execution({
  query_execution_ids: ["QueryExecutionId"], # required
})

Response structure


resp.query_executions #=> Array
resp.query_executions[0].query_execution_id #=> String
resp.query_executions[0].query #=> String
resp.query_executions[0].result_configuration.output_location #=> String
resp.query_executions[0].result_configuration.encryption_configuration.encryption_option #=> String, one of "SSE_S3", "SSE_KMS", "CSE_KMS"
resp.query_executions[0].result_configuration.encryption_configuration.kms_key #=> String
resp.query_executions[0].query_execution_context.database #=> String
resp.query_executions[0].status.state #=> String, one of "QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "CANCELLED"
resp.query_executions[0].status.state_change_reason #=> String
resp.query_executions[0].status.submission_date_time #=> Time
resp.query_executions[0].status.completion_date_time #=> Time
resp.query_executions[0].statistics.engine_execution_time_in_millis #=> Integer
resp.query_executions[0].statistics.data_scanned_in_bytes #=> Integer
resp.unprocessed_query_execution_ids #=> Array
resp.unprocessed_query_execution_ids[0].query_execution_id #=> String
resp.unprocessed_query_execution_ids[0].error_code #=> String
resp.unprocessed_query_execution_ids[0].error_message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_execution_ids (required, Array<String>)

    An array of query execution IDs.

Returns:

See Also:



248
249
250
251
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 248

def batch_get_query_execution(params = {}, options = {})
  req = build_request(:batch_get_query_execution, params)
  req.send_request(options)
end

#create_named_query(params = {}) ⇒ Types::CreateNamedQueryOutput

Creates a named query.

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

Examples:

Request syntax with placeholder values


resp = client.create_named_query({
  name: "NameString", # required
  description: "DescriptionString",
  database: "DatabaseString", # required
  query_string: "QueryString", # required
  client_request_token: "IdempotencyToken",
})

Response structure


resp.named_query_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :name (required, String)

    The plain language name for the query.

  • :description (String)

    A brief explanation of the query.

  • :database (required, String)

    The database to which the query belongs.

  • :query_string (required, String)

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

  • :client_request_token (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.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

See Also:



311
312
313
314
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 311

def create_named_query(params = {}, options = {})
  req = build_request(:create_named_query, params)
  req.send_request(options)
end

#delete_named_query(params = {}) ⇒ Struct

Deletes a named query.

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

Examples:

Request syntax with placeholder values


resp = client.delete_named_query({
  named_query_id: "NamedQueryId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :named_query_id (required, String)

    The unique ID of the query to delete.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

  • (Struct)

    Returns an empty response.

See Also:



343
344
345
346
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 343

def delete_named_query(params = {}, options = {})
  req = build_request(:delete_named_query, params)
  req.send_request(options)
end

#get_named_query(params = {}) ⇒ Types::GetNamedQueryOutput

Returns information about a single query.

Examples:

Request syntax with placeholder values


resp = client.get_named_query({
  named_query_id: "NamedQueryId", # required
})

Response structure


resp.named_query.name #=> String
resp.named_query.description #=> String
resp.named_query.database #=> String
resp.named_query.query_string #=> String
resp.named_query.named_query_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :named_query_id (required, String)

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

Returns:

See Also:



375
376
377
378
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 375

def get_named_query(params = {}, options = {})
  req = build_request(:get_named_query, params)
  req.send_request(options)
end

#get_query_execution(params = {}) ⇒ Types::GetQueryExecutionOutput

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.

Examples:

Request syntax with placeholder values


resp = client.get_query_execution({
  query_execution_id: "QueryExecutionId", # required
})

Response structure


resp.query_execution.query_execution_id #=> String
resp.query_execution.query #=> String
resp.query_execution.result_configuration.output_location #=> String
resp.query_execution.result_configuration.encryption_configuration.encryption_option #=> String, one of "SSE_S3", "SSE_KMS", "CSE_KMS"
resp.query_execution.result_configuration.encryption_configuration.kms_key #=> String
resp.query_execution.query_execution_context.database #=> String
resp.query_execution.status.state #=> String, one of "QUEUED", "RUNNING", "SUCCEEDED", "FAILED", "CANCELLED"
resp.query_execution.status.state_change_reason #=> String
resp.query_execution.status.submission_date_time #=> Time
resp.query_execution.status.completion_date_time #=> Time
resp.query_execution.statistics.engine_execution_time_in_millis #=> Integer
resp.query_execution.statistics.data_scanned_in_bytes #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_execution_id (required, String)

    The unique ID of the query execution.

Returns:

See Also:



416
417
418
419
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 416

def get_query_execution(params = {}, options = {})
  req = build_request(:get_query_execution, params)
  req.send_request(options)
end

#get_query_results(params = {}) ⇒ Types::GetQueryResultsOutput

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.

Examples:

Request syntax with placeholder values


resp = client.get_query_results({
  query_execution_id: "QueryExecutionId", # required
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.result_set.rows #=> Array
resp.result_set.rows[0].data #=> Array
resp.result_set.rows[0].data[0].var_char_value #=> String
resp.result_set..column_info #=> Array
resp.result_set..column_info[0].catalog_name #=> String
resp.result_set..column_info[0].schema_name #=> String
resp.result_set..column_info[0].table_name #=> String
resp.result_set..column_info[0].name #=> String
resp.result_set..column_info[0].label #=> String
resp.result_set..column_info[0].type #=> String
resp.result_set..column_info[0].precision #=> Integer
resp.result_set..column_info[0].scale #=> Integer
resp.result_set..column_info[0].nullable #=> String, one of "NOT_NULL", "NULLABLE", "UNKNOWN"
resp.result_set..column_info[0].case_sensitive #=> Boolean
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_execution_id (required, String)

    The unique ID of the query execution.

  • :next_token (String)

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

  • :max_results (Integer)

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

Returns:

See Also:



470
471
472
473
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 470

def get_query_results(params = {}, options = {})
  req = build_request(:get_query_results, params)
  req.send_request(options)
end

#list_named_queries(params = {}) ⇒ Types::ListNamedQueriesOutput

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.

Examples:

Request syntax with placeholder values


resp = client.list_named_queries({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.named_query_ids #=> Array
resp.named_query_ids[0] #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

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

  • :max_results (Integer)

    The maximum number of queries to return in this request.

Returns:

See Also:



513
514
515
516
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 513

def list_named_queries(params = {}, options = {})
  req = build_request(:list_named_queries, params)
  req.send_request(options)
end

#list_query_executions(params = {}) ⇒ Types::ListQueryExecutionsOutput

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.

Examples:

Request syntax with placeholder values


resp = client.list_query_executions({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.query_execution_ids #=> Array
resp.query_execution_ids[0] #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

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

  • :max_results (Integer)

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

Returns:

See Also:



556
557
558
559
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 556

def list_query_executions(params = {}, options = {})
  req = build_request(:list_query_executions, params)
  req.send_request(options)
end

#start_query_execution(params = {}) ⇒ Types::StartQueryExecutionOutput

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.

Examples:

Request syntax with placeholder values


resp = client.start_query_execution({
  query_string: "QueryString", # required
  client_request_token: "IdempotencyToken",
  query_execution_context: {
    database: "DatabaseString",
  },
  result_configuration: { # required
    output_location: "String", # required
    encryption_configuration: {
      encryption_option: "SSE_S3", # required, accepts SSE_S3, SSE_KMS, CSE_KMS
      kms_key: "String",
    },
  },
})

Response structure


resp.query_execution_id #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_string (required, String)

    The SQL query statements to be executed.

  • :client_request_token (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.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

  • :query_execution_context (Types::QueryExecutionContext)

    The database within which the query executes.

  • :result_configuration (required, Types::ResultConfiguration)

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

Returns:

See Also:



625
626
627
628
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 625

def start_query_execution(params = {}, options = {})
  req = build_request(:start_query_execution, params)
  req.send_request(options)
end

#stop_query_execution(params = {}) ⇒ Struct

Stops a query execution.

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

Examples:

Request syntax with placeholder values


resp = client.stop_query_execution({
  query_execution_id: "QueryExecutionId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :query_execution_id (required, String)

    The unique ID of the query execution to stop.

    A suitable default value is auto-generated. You should normally not need to pass this option.**

Returns:

  • (Struct)

    Returns an empty response.

See Also:



657
658
659
660
# File 'gems/aws-sdk-athena/lib/aws-sdk-athena/client.rb', line 657

def stop_query_execution(params = {}, options = {})
  req = build_request(:stop_query_execution, params)
  req.send_request(options)
end