Amazon Athena Named Queries API

Operations for creating and managing saved SQL queries

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

amazon-athena-named-queries-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amazon Athena Data Catalogs Named Queries API
  description: Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run.
  version: '2017-05-18'
  contact:
    name: AWS Support
    url: https://aws.amazon.com/premiumsupport/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://athena.us-east-1.amazonaws.com
  description: Amazon Athena API endpoint
security:
- sigv4: []
tags:
- name: Named Queries
  description: Operations for creating and managing saved SQL queries
paths:
  /?Action=CreateNamedQuery:
    post:
      operationId: createNamedQuery
      summary: Amazon Athena Create Named Query
      description: Creates a named query in the specified workgroup. Requires that you have access to the workgroup.
      tags:
      - Named Queries
      x-microcks-operation:
        delay: 100
        dispatcher: QUERY_MATCH
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNamedQueryInput'
            examples:
              default:
                x-microcks-default: true
                value:
                  Name: MyNamedQuery
                  Description: A sample named query
                  Database: my_database
                  QueryString: SELECT * FROM my_table WHERE date > '2024-01-01'
                  WorkGroup: primary
      responses:
        '200':
          description: Named query created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateNamedQueryOutput'
              examples:
                default:
                  x-microcks-default: true
                  value:
                    NamedQueryId: c3d4e5f6-a7b8-9012-cdef-123456789012
  /?Action=DeleteNamedQuery:
    post:
      operationId: deleteNamedQuery
      summary: Amazon Athena Delete Named Query
      description: Deletes the named query if you have access to the workgroup in which the query was saved.
      tags:
      - Named Queries
      x-microcks-operation:
        delay: 100
        dispatcher: QUERY_MATCH
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteNamedQueryInput'
            examples:
              default:
                x-microcks-default: true
                value:
                  NamedQueryId: c3d4e5f6-a7b8-9012-cdef-123456789012
      responses:
        '200':
          description: Named query deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteNamedQueryOutput'
              examples:
                default:
                  x-microcks-default: true
                  value: {}
  /?Action=GetNamedQuery:
    post:
      operationId: getNamedQuery
      summary: Amazon Athena Get Named Query
      description: Returns information about a single query. Requires that you have access to the workgroup in which the query was saved.
      tags:
      - Named Queries
      x-microcks-operation:
        delay: 100
        dispatcher: QUERY_MATCH
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetNamedQueryInput'
            examples:
              default:
                x-microcks-default: true
                value:
                  NamedQueryId: c3d4e5f6-a7b8-9012-cdef-123456789012
      responses:
        '200':
          description: Named query retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetNamedQueryOutput'
              examples:
                default:
                  x-microcks-default: true
                  value:
                    NamedQuery:
                      NamedQueryId: c3d4e5f6-a7b8-9012-cdef-123456789012
                      Name: MyNamedQuery
                      Description: A sample named query
                      Database: my_database
                      QueryString: SELECT * FROM my_table WHERE date > '2024-01-01'
                      WorkGroup: primary
  /?Action=ListNamedQueries:
    post:
      operationId: listNamedQueries
      summary: Amazon Athena List Named Queries
      description: Provides a list of available query IDs only for queries saved in the specified workgroup.
      tags:
      - Named Queries
      x-microcks-operation:
        delay: 100
        dispatcher: QUERY_MATCH
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListNamedQueriesInput'
            examples:
              default:
                x-microcks-default: true
                value:
                  WorkGroup: primary
                  MaxResults: 10
      responses:
        '200':
          description: Named query IDs listed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListNamedQueriesOutput'
              examples:
                default:
                  x-microcks-default: true
                  value:
                    NamedQueryIds:
                    - c3d4e5f6-a7b8-9012-cdef-123456789012
                    NextToken: ''
  /?Action=BatchGetNamedQuery:
    post:
      operationId: batchGetNamedQuery
      summary: Amazon Athena Batch Get Named Query
      description: 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.
      tags:
      - Named Queries
      x-microcks-operation:
        delay: 100
        dispatcher: QUERY_MATCH
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchGetNamedQueryInput'
            examples:
              default:
                x-microcks-default: true
                value:
                  NamedQueryIds:
                  - c3d4e5f6-a7b8-9012-cdef-123456789012
      responses:
        '200':
          description: Named queries retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchGetNamedQueryOutput'
              examples:
                default:
                  x-microcks-default: true
                  value:
                    NamedQueries:
                    - NamedQueryId: c3d4e5f6-a7b8-9012-cdef-123456789012
                      Name: MyNamedQuery
                      Database: my_database
                      QueryString: SELECT * FROM my_table
                    UnprocessedNamedQueryIds: []
components:
  schemas:
    ListNamedQueriesOutput:
      type: object
      properties:
        NamedQueryIds:
          type: array
          items:
            type: string
        NextToken:
          type: string
    DeleteNamedQueryOutput:
      type: object
    NamedQuery:
      type: object
      properties:
        Name:
          type: string
        Description:
          type: string
        Database:
          type: string
        QueryString:
          type: string
        NamedQueryId:
          type: string
        WorkGroup:
          type: string
    GetNamedQueryInput:
      type: object
      required:
      - NamedQueryId
      properties:
        NamedQueryId:
          type: string
    CreateNamedQueryOutput:
      type: object
      properties:
        NamedQueryId:
          type: string
          description: The unique ID of the query
    ListNamedQueriesInput:
      type: object
      properties:
        NextToken:
          type: string
        MaxResults:
          type: integer
        WorkGroup:
          type: string
    CreateNamedQueryInput:
      type: object
      required:
      - Name
      - Database
      - QueryString
      properties:
        Name:
          type: string
          description: The query name
        Description:
          type: string
          description: The query description
        Database:
          type: string
          description: The database to which the query belongs
        QueryString:
          type: string
          description: The contents of the query with all query statements
        ClientRequestToken:
          type: string
        WorkGroup:
          type: string
          description: The name of the workgroup in which the named query is being created
    DeleteNamedQueryInput:
      type: object
      required:
      - NamedQueryId
      properties:
        NamedQueryId:
          type: string
    BatchGetNamedQueryInput:
      type: object
      required:
      - NamedQueryIds
      properties:
        NamedQueryIds:
          type: array
          items:
            type: string
    BatchGetNamedQueryOutput:
      type: object
      properties:
        NamedQueries:
          type: array
          items:
            $ref: '#/components/schemas/NamedQuery'
        UnprocessedNamedQueryIds:
          type: array
          items:
            $ref: '#/components/schemas/UnprocessedNamedQueryId'
    UnprocessedNamedQueryId:
      type: object
      properties:
        NamedQueryId:
          type: string
        ErrorCode:
          type: string
        ErrorMessage:
          type: string
    GetNamedQueryOutput:
      type: object
      properties:
        NamedQuery:
          $ref: '#/components/schemas/NamedQuery'
  securitySchemes:
    sigv4:
      type: apiKey
      name: Authorization
      in: header
      description: AWS Signature Version 4