Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Вы находитесь на странице архива. Актуальная документация доступна по ссылке.

Спецификация OpenAPI

Полная спецификация REST API доступна по ссылке, а также приведена ниже.

openapi: 3.0.0
info:
  title: ProstorePublicAPI
  version: 1.0.0
  description: Prostore public Rest API
  contact:
    name: Alexander Senko
servers:
  - url: 'http://localhost:3000'
paths:
  /api/v1/datamarts/query:
    post:
      summary: Execute Query based on SQL+ command
      operationId: post-query-execute
      responses:
        '200':
          $ref: '#/components/responses/query'
        '500':
          $ref: '#/components/responses/500'
      description: Execute a query in simple or prepared modes. The query can be any supported SQL+ command.
      tags:
        - SQL+ Query
      parameters:
        - $ref: '#/components/parameters/query-format'
        - $ref: '#/components/parameters/x-request-id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/query-request'
            examples:
              simple query:
                value:
                  query: 'SELECT id, data FROM test_db.test_table WHERE id > 3 AND id < 6 AND (data = ''data'' OR data IS null) ORDER BY id DATASOURCE_TYPE = ''adb'''
                  queryId: '12345'
              prepared query:
                value:
                  query: 'INSERT INTO test_db.test_table (id, data) values (?, ?), (?, ?), (?, ?)'
                  params:
                    - value: 4
                      type: INTEGER
                    - value: data
                      type: VARCHAR
                    - value: 5
                      type: INTEGER
                    - value: null
                      type: VARCHAR
                    - value: 6
                      type: INTEGER
                    - value: null
                      type: VARCHAR
        description: |-
          - If the optional <b>parameter "params" is not specified</b>, the request is executed as <b>simple query</b>, when all parameter values are passed in the query string itself.

          - If the optional <b>parameter "params" is specified</b>, the request is executed as <b>prepared query</b>. In this case, all values within the query string, represented as a "?", are replaced with the corresponding value from the "params" array.

          Datamart should be specified inside of query text.
    parameters: []
  '/api/v1/datamarts/{datamart}/query':
    post:
      summary: Execute Query based on SQL+ command
      operationId: post-query-datamart-execute
      responses:
        '200':
          $ref: '#/components/responses/query'
        '500':
          $ref: '#/components/responses/500'
      description: Execute a query in simple or prepared modes based on specified datamart. The query can be any supported SQL+ command.
      tags:
        - SQL+ Query
      parameters:
        - $ref: '#/components/parameters/query-format'
        - $ref: '#/components/parameters/x-request-id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/query-request'
            examples:
              simple query:
                value:
                  query: 'SELECT id, data FROM test_table WHERE id > 3 AND id < 6 AND (data = ''data'' OR data IS null) ORDER BY id DATASOURCE_TYPE = ''adb'''
              prepared query:
                value:
                  query: 'INSERT INTO test_table (id, data) values (?, ?), (?, ?), (?, ?)'
                  queryId: '12345'
                  params:
                    - value: 4
                      type: INTEGER
                    - value: data
                      type: VARCHAR
                    - value: 5
                      type: INTEGER
                    - value: null
                      type: VARCHAR
                    - value: 6
                      type: INTEGER
                    - value: null
                      type: VARCHAR
        description: |-
          - If the optional <b>parameter "params" is not specified</b>, the request is executed as <b>simple query</b>, when all parameter values are passed in the query string itself.

          - If the optional <b>parameter "params" is specified</b>, the request is executed as <b>prepared query</b>. In this case, all values within the query string, represented as a "?", are replaced with the corresponding value from the "params" array.
    parameters:
      - $ref: '#/components/parameters/datamart'
  '/api/v1/datamarts/{datamart}/deltas/{deltaNum}':
    get:
      summary: Get Delta by Num
      tags:
        - Deltas
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: Information about delta.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delta'
              examples:
                delta:
                  value:
                    deltaNum: 0
                    deltaDate: '2022-09-05 11:40:00'
                    deltaServerDate: '2022-09-05 11:39:02'
                    cnFrom: 0
                    cnTo: 3
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-deltas-delta-num
      description: 'A query that returns the information about delta specified by number. If the delta does not exist, response of the type "500" will be returned for it.'
    parameters:
      - $ref: '#/components/parameters/datamart'
      - schema:
          type: integer
          example: 0
        name: deltaNum
        in: path
        required: true
        description: The number of delta for which the information should be fetched
  '/api/v1/datamarts/{datamart}/deltas/current':
    get:
      summary: Get Delta-now
      tags:
        - Deltas
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: Information about delta-now.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delta'
              examples:
                delta:
                  value:
                    deltaNum: 1
                    deltaDate: '2022-09-05 11:50:00'
                    deltaServerDate: '2022-09-05 11:49:20'
                    cnFrom: 4
                    cnTo: 7
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-deltas-current
      description: 'A query that returns a delta-now information. If the delta does not exist, response of the type "500" will be returned for it.'
    parameters:
      - $ref: '#/components/parameters/datamart'
  '/api/v1/datamarts/{datamart}/deltas/latest':
    get:
      summary: 'Get Delta-hot, Delta-ok'
      tags:
        - Deltas
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: Information about delta-ok and delta-hot.
          content:
            application/json:
              schema:
                type: object
                properties:
                  hot:
                    anyOf:
                      - $ref: '#/components/schemas/null'
                      - $ref: '#/components/schemas/delta-hot'
                  ok:
                    anyOf:
                      - $ref: '#/components/schemas/null'
                      - $ref: '#/components/schemas/delta'
              examples:
                'delta-ok(+), delta-hot(+)':
                  value:
                    hot:
                      deltaNum: 8
                      cnFrom: 9
                      cnTo: 9
                      cnMax: 9
                      rollingBack: false
                      writeOperationsFinished:
                        - tableName: transactions
                          cnList:
                            - 9
                    ok:
                      deltaNum: 7
                      deltaDate: '2022-08-09 11:38:04'
                      deltaServerDate: '2022-08-09 11:38:04'
                      cnFrom: 7
                      cnTo: 8
                'delta-ok(+), delta-hot(-)':
                  value:
                    hot: null
                    ok:
                      deltaNum: 7
                      deltaDate: '2022-08-09 11:38:04'
                      deltaServerDate: '2022-08-09 11:38:04'
                      cnFrom: 7
                      cnTo: 8
                'delta-ok(-), delta-hot(-)':
                  value:
                    hot: null
                    ok: null
                'delta-ok(-), delta-hot(+)':
                  value:
                    hot:
                      deltaNum: 0
                      cnFrom: 0
                      cnTo: null
                      cnMax: -1
                      rollingBack: false
                      writeOperationsFinished: null
                    ok: null
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-deltas-latest
      description: 'A query that returns a delta-ok and delta-hot information. If any of the deltas does not exist, null will be returned for it.'
    parameters:
      - $ref: '#/components/parameters/datamart'
  '/api/v1/datamarts/{datamart}/deltas/latest/hot':
    get:
      summary: Get Delta-hot
      tags:
        - Deltas
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: Information about delta-hot.
          content:
            application/json:
              schema:
                type: object
                properties:
                  hot:
                    anyOf:
                      - $ref: '#/components/schemas/null'
                      - $ref: '#/components/schemas/delta-hot'
              examples:
                delta-hot:
                  value:
                    hot:
                      deltaNum: 8
                      cnFrom: 9
                      cnTo: 9
                      cnMax: 9
                      rollingBack: false
                      writeOperationsFinished:
                        - tableName: transactions
                          cnList:
                            - 9
                delta-hot empty:
                  value:
                    hot: null
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-deltas-latest-hot
      description: 'A query that returns a delta-hot information. If the delta does not exist, null will be returned for it.'
    parameters:
      - $ref: '#/components/parameters/datamart'
  '/api/v1/datamarts/{datamart}/deltas/latest/ok':
    get:
      summary: Get Delta-ok
      tags:
        - Deltas
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: Information about delta-ok.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    anyOf:
                      - $ref: '#/components/schemas/null'
                      - $ref: '#/components/schemas/delta'
              examples:
                delta-ok:
                  value:
                    ok:
                      deltaNum: 7
                      deltaDate: '2022-08-09 11:38:04'
                      deltaServerDate: '2022-08-09 11:38:04'
                      cnFrom: 7
                      cnTo: 8
                delta-ok empty:
                  value:
                    ok: null
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-deltas-latest-ok
      description: 'A query that returns a delta-ok information. If the delta does not exist, null will be returned for it.'
    parameters:
      - $ref: '#/components/parameters/datamart'
  /api/v1/datamarts:
    get:
      summary: List of Datamarts
      tags:
        - Schema
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  datamarts:
                    type: array
                    items:
                      type: string
                required:
                  - datamarts
              examples:
                ResultSet:
                  value:
                    datamarts:
                      - TESTDB1
                      - TESTDB2
                      - TESTDB3
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-schema-datamarts
      description: Get a list of datamarts based on the information schema.
    parameters: []
  '/api/v1/datamarts/{datamart}/entities':
    parameters:
      - $ref: '#/components/parameters/datamart'
    get:
      summary: Datamart Entities
      tags:
        - Schema
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  entities:
                    type: array
                    items:
                      type: string
                required:
                  - entities
              examples:
                ResultSet:
                  value:
                    entities:
                      - TESTTABLE
                      - TESTTABLE_VIEW
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-schema-datamart
      description: Get a list of entities of the specified datamart based on the information schema.
  '/api/v1/datamarts/{datamart}/entities/{entity}':
    parameters:
      - $ref: '#/components/parameters/datamart'
      - $ref: '#/components/parameters/entity'
    get:
      summary: Entity Attributes
      tags:
        - Schema
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  schema:
                    type: string
                  viewQuery:
                    type: string
                    nullable: true
                  entityType:
                    type: string
                    enum:
                      - TABLE
                      - UPLOAD_EXTERNAL_TABLE
                      - DOWNLOAD_EXTERNAL_TABLE
                      - READABLE_EXTERNAL_TABLE
                      - WRITEABLE_EXTERNAL_TABLE
                      - VIEW
                      - MATERIALIZED_VIEW
                  externalTableFormat:
                    type: string
                    nullable: true
                  externalTableSchema:
                    type: string
                    nullable: true
                  externalTableLocationType:
                    type: string
                    nullable: true
                  externalTableLocationPath:
                    type: string
                    nullable: true
                  externalTableOptions:
                    type: object
                    nullable: true
                  externalTableDownloadChunkSize:
                    type: integer
                    nullable: true
                  externalTableUploadMessageLimit:
                    type: integer
                    nullable: true
                  destination:
                    type: array
                    nullable: true
                    items:
                      type: string
                  materializedDeltaNum:
                    type: integer
                    nullable: true
                  materializedDataSource:
                    type: string
                    nullable: true
                  fields:
                    type: array
                    items:
                      type: object
                      properties:
                        ordinalPosition:
                          type: integer
                        name:
                          type: string
                        type:
                          $ref: '#/components/schemas/data-type'
                        size:
                          type: integer
                          nullable: true
                        accuracy:
                          type: integer
                          nullable: true
                        nullable:
                          type: boolean
                        primaryOrder:
                          type: integer
                          nullable: true
                        shardingOrder:
                          type: integer
                          nullable: true
                        defaultValue:
                          anyOf:
                            - type: string
                              nullable: true
                            - type: number
                            - type: integer
                            - type: boolean
                      required:
                        - ordinalPosition
                        - name
                        - type
                        - size
                        - accuracy
                        - nullable
                        - primaryOrder
                        - shardingOrder
                        - defaultValue
                  materializedDeltaSyncDate:
                    type: string
                    nullable: true
                required:
                  - name
                  - schema
                  - viewQuery
                  - entityType
                  - externalTableFormat
                  - externalTableSchema
                  - externalTableLocationType
                  - externalTableLocationPath
                  - externalTableOptions
                  - externalTableDownloadChunkSize
                  - externalTableUploadMessageLimit
                  - destination
                  - materializedDeltaNum
                  - materializedDataSource
                  - fields
                  - materializedDeltaSyncDate
              examples:
                TABLE:
                  value:
                    name: all_types_transactions
                    schema: testdb
                    viewQuery: null
                    entityType: TABLE
                    externalTableFormat: null
                    externalTableSchema: null
                    externalTableLocationType: null
                    externalTableLocationPath: null
                    externalTableOptions: null
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: null
                    destination:
                      - ADG
                      - ADQM
                      - ADP
                      - ADB
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: transaction_id
                        type: BIGINT
                        size: null
                        accuracy: null
                        nullable: false
                        primaryOrder: 1
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 1
                        name: account_id
                        type: BIGINT
                        size: null
                        accuracy: null
                        nullable: false
                        primaryOrder: 2
                        shardingOrder: 1
                        defaultValue: null
                      - ordinalPosition: 2
                        name: double_col
                        type: DOUBLE
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 3
                        name: float_col
                        type: FLOAT
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 4
                        name: varchar_col
                        type: VARCHAR
                        size: 36
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 5
                        name: boolean_col
                        type: BOOLEAN
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 6
                        name: int_col
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 7
                        name: bigint_col
                        type: BIGINT
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 8
                        name: date_col
                        type: DATE
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 9
                        name: timestamp_col
                        type: TIMESTAMP
                        size: null
                        accuracy: 6
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 10
                        name: time_col
                        type: TIME
                        size: null
                        accuracy: 5
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 11
                        name: uuid_col
                        type: UUID
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 12
                        name: char_col
                        type: CHAR
                        size: 10
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 13
                        name: int32_col
                        type: INT32
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 14
                        name: link_col
                        type: LINK
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                UPLOAD_EXTERNAL_TABLE:
                  value:
                    name: table_ext_upload
                    schema: testdb
                    viewQuery: null
                    entityType: UPLOAD_EXTERNAL_TABLE
                    externalTableFormat: AVRO
                    externalTableSchema: '{"type":"record","name":"table_ext_upload","namespace":"testdb","fields":[{"name":"id","type":["null","long"],"default":null},{"name":"data","type":["null",{"type":"string","avro.java.string":"String"}],"default":null},{"name":"sys_op","type":"int","default":0}]}'
                    externalTableLocationType: KAFKA
                    externalTableLocationPath: 'kafka://server/testdb_upload'
                    externalTableOptions: {}
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: 1000
                    destination: null
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                DOWNLOAD_EXTERNAL_TABLE:
                  value:
                    name: table_ext_download
                    schema: testdb
                    viewQuery: null
                    entityType: DOWNLOAD_EXTERNAL_TABLE
                    externalTableFormat: AVRO
                    externalTableSchema: '{"type":"record","name":"table_ext_download","namespace":"testdb","fields":[{"name":"id","type":["null","long"],"default":null},{"name":"data","type":["null",{"type":"string","avro.java.string":"String"}],"default":null}]}'
                    externalTableLocationType: KAFKA
                    externalTableLocationPath: 'kafka://server/testdb_download'
                    externalTableOptions: null
                    externalTableDownloadChunkSize: 1000
                    externalTableUploadMessageLimit: null
                    destination: null
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                WRITEABLE_EXTERNAL_TABLE:
                  value:
                    name: table_ext_write
                    schema: testdb
                    viewQuery: null
                    entityType: WRITEABLE_EXTERNAL_TABLE
                    externalTableFormat: null
                    externalTableSchema: '{"type":"record","name":"table_ext_write_adb","namespace":"testdb","fields":[{"name":"id","type":"long"},{"name":"data","type":["null",{"type":"string","avro.java.string":"String"}],"default":null},{"name":"sys_op","type":["null","int"],"default":null}]}'
                    externalTableLocationType: CORE_ADB
                    externalTableLocationPath: testdb.table_standalone
                    externalTableOptions: {}
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: null
                    destination:
                      - ADB
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: false
                        primaryOrder: 1
                        shardingOrder: 1
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 2
                        name: sys_op
                        type: INT32
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                READABLE_EXTERNAL_TABLE:
                  value:
                    name: table_ext_read
                    schema: testdb
                    viewQuery: null
                    entityType: READABLE_EXTERNAL_TABLE
                    externalTableFormat: null
                    externalTableSchema: '{"type":"record","name":"table_ext_read","namespace":"testdb","fields":[{"name":"id","type":"long"},{"name":"data","type":["null",{"type":"string","avro.java.string":"String"}],"default":null},{"name":"sys_op","type":["null","int"],"default":null}]}'
                    externalTableLocationType: CORE_ADB
                    externalTableLocationPath: testdb.table_standalone
                    externalTableOptions:
                      auto.create.table.enable: 'false'
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: null
                    destination:
                      - ADB
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: false
                        primaryOrder: 1
                        shardingOrder: 1
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 2
                        name: sys_op
                        type: INT32
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                VIEW:
                  value:
                    name: test_view
                    schema: testdb
                    viewQuery: 'SELECT id, data FROM testdb.test_table'
                    entityType: VIEW
                    externalTableFormat: null
                    externalTableSchema: null
                    externalTableLocationType: null
                    externalTableLocationPath: null
                    externalTableOptions: null
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: null
                    destination: null
                    materializedDeltaNum: null
                    materializedDataSource: null
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: null
                MATERIALIZED_VIEW:
                  value:
                    name: test_mat_view
                    schema: testdb
                    viewQuery: 'SELECT id AS id, data AS data FROM testdb.test_table'
                    entityType: MATERIALIZED_VIEW
                    externalTableFormat: null
                    externalTableSchema: null
                    externalTableLocationType: null
                    externalTableLocationPath: null
                    externalTableOptions: null
                    externalTableDownloadChunkSize: null
                    externalTableUploadMessageLimit: null
                    destination:
                      - ADP
                    materializedDeltaNum: 9
                    materializedDataSource: ADB
                    fields:
                      - ordinalPosition: 0
                        name: id
                        type: INTEGER
                        size: null
                        accuracy: null
                        nullable: false
                        primaryOrder: 1
                        shardingOrder: 1
                        defaultValue: null
                      - ordinalPosition: 1
                        name: data
                        type: VARCHAR
                        size: 30
                        accuracy: null
                        nullable: true
                        primaryOrder: null
                        shardingOrder: null
                        defaultValue: null
                    materializedDeltaSyncDate: '2022-11-23 13:33:01.033'
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-schema-entity
      description: Get a list of attributes of the specified entity based on the information schema.
  '/api/v1/datamarts/{datamart}/entities/{entity}/ddl':
    get:
      summary: Get Entity DDL script
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  ddlScript:
                    type: string
                required:
                  - ddlScript
              examples:
                ResultSet:
                  value:
                    ddlScript: 'CREATE TABLE TESTDB.ALL_TYPES_TRANSACTIONS (TRANSACTION_ID BIGINT NOT NULL, ACCOUNT_ID BIGINT NOT NULL, DOUBLE_COL DOUBLE NULL, FLOAT_COL FLOAT NULL, VARCHAR_COL VARCHAR(36) NULL, BOOLEAN_COL BOOLEAN NULL, INT_COL INT NULL, BIGINT_COL BIGINT NULL, DATE_COL DATE NULL, TIMESTAMP_COL TIMESTAMP(6) NULL, TIME_COL TIME(5) NULL, UUID_COL UUID NULL, CHAR_COL CHAR(10) NULL, INT32_COL INT32 NULL, LINK_COL LINK NULL, PRIMARY KEY (TRANSACTION_ID, ACCOUNT_ID)) DISTRIBUTED BY (ACCOUNT_ID) DATASOURCE_TYPE (ADB, ADG, ADP, ADQM)'
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-schema-entity-ddl
      description: |-
        Returns current create entity SQL script:
        - SQL+ DDL CREATE TABLE
        - SQL+ DDL CREATE VIEW
        - SQL+ DDL CREATE MATERIALIZED VIEW
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      tags:
        - Schema
    parameters:
      - $ref: '#/components/parameters/datamart'
      - $ref: '#/components/parameters/entity'
  '/api/v1/datamarts/{datamart}/sync':
    parameters:
      - $ref: '#/components/parameters/datamart'
    post:
      summary: Sync ServiceDB
      operationId: delete-sync-datamart
      responses:
        '200':
          description: OK
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          description: Internal Server Error
      description: Force sync ServiceDB servers
      tags:
        - Schema
      parameters:
        - $ref: '#/components/parameters/x-request-id'
  /api/v1/versions:
    get:
      summary: Check Versions
      tags:
        - Check
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  versions:
                    type: array
                    items:
                      type: object
                      properties:
                        componentName:
                          type: string
                        version:
                          type: string
                      required:
                        - componentName
                        - version
                required:
                  - versions
              examples:
                ResultSet:
                  value:
                    versions:
                      - componentName: query-execution-core
                        version: 5.8.0-SNAPSHOT
                      - componentName: tarantool
                        version: 2.10.0-31-g2d20ef4
                      - componentName: tarantool-cartridge
                        version: 2.7.5
                      - componentName: kafka-tarantool connector
                        version: 1.5.8-1
                      - componentName: adb cluster
                        version: 'PostgreSQL 9.4.24 (Greenplum Database 6.17.5 build 6.17.5_arenadata26-714.git18d86c5.el7) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit compiled on Sep 27 2021 11:01:47'
                      - componentName: kafka-greenplum connector writer (fdw)
                        version: 0.10.2
                      - componentName: kafka-greenplum connector reader (pxf)
                        version: '1.0'
                      - componentName: adp instance
                        version: 'PostgreSQL 13.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit'
                      - componentName: kafka-postgres connector reader
                        version: 0.4.0-SNAPSHOT
                      - componentName: kafka-postgres connector writer
                        version: 0.4.0-SNAPSHOT
                      - componentName: adqm cluster
                        version: 21.8.13.6
                      - componentName: kafka-clickhouse connector reader
                        version: 3.9.0-SNAPSHOT
                      - componentName: kafka-clickhouse connector writer
                        version: 3.9.0-SNAPSHOT
                      - componentName: status-monitor
                        version: 5.8.0-SNAPSHOT
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          description: Internal Server Error
      operationId: get-check-versions
      description: Get actual versions of components used.
    parameters: []
  /api/v1/datamarts/all/statistics:
    parameters: []
    get:
      summary: Get Statistics for All Datamarts
      operationId: get-statistics
      responses:
        '200':
          $ref: '#/components/responses/statistics'
        '500':
          $ref: '#/components/responses/500'
      description: Get statistics information of all datamart's about query performance.
      tags:
        - Statistics
      parameters:
        - $ref: '#/components/parameters/x-request-id'
    post:
      summary: Reset Statistics for All Datamarts
      operationId: delete-statistics
      responses:
        '200':
          description: OK
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      description: Reset statistics information of all datamart's about query performance.
      tags:
        - Statistics
      parameters:
        - $ref: '#/components/parameters/x-request-id'
  '/api/v1/datamarts/{datamart}/statistics':
    get:
      summary: Get Datamart statistics
      responses:
        '200':
          $ref: '#/components/responses/statistics'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-datamart-statistics
      description: Returns statistics information of all entities of a datamart specified about query performance.
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      tags:
        - Statistics
    parameters:
      - $ref: '#/components/parameters/datamart'
    post:
      summary: Reset Datamart statistics
      operationId: delete-datamart-statistics
      responses:
        '200':
          description: OK
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      description: Reset statistics information of all entities of a datamart specified about query performance.
      tags:
        - Statistics
      parameters:
        - $ref: '#/components/parameters/x-request-id'
  '/api/v1/datamarts/{datamart}/entities/{entity}/statistics':
    get:
      summary: Get Entity statistics
      responses:
        '200':
          description: ResultSet
          content:
            application/json:
              schema:
                type: object
                properties:
                  statistics:
                    anyOf:
                      - $ref: '#/components/schemas/null'
                      - $ref: '#/components/schemas/statistics'
                required:
                  - statistics
              examples:
                ResultSet:
                  value:
                    statistics:
                      entityCatalog: null
                      entitySchema: testdb
                      entityName: test_table
                      readCount: 1
                      readDuration: 29
                      readErrorCount: 0
                      firstRead: '2022-08-18T06:52:59.643Z'
                      lastRead: '2022-08-18T06:52:59.643Z'
                      downloadCount: 1
                      downloadDuration: 1229
                      downloadErrorCount: 0
                      firstDownload: '2022-08-18T06:54:27.358Z'
                      lastDownload: '2022-08-18T06:54:27.358Z'
                      writeCount: 1
                      writeDuration: 624
                      writeErrorCount: 0
                      firstWrite: '2022-08-18T06:54:15.697Z'
                      lastWrite: '2022-08-18T06:54:15.697Z'
                      uploadCount: 1
                      uploadDuration: 6270
                      uploadErrorCount: 0
                      firstUpload: '2022-08-18T06:52:47.157Z'
                      lastUpload: '2022-08-18T06:52:47.157Z'
                      rowsCount: 16
                      rowsCountDelta: 9
                ResultSet (empty):
                  value:
                    statistics: null
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      operationId: get-entity-statistics
      description: Returns statistics information of specified entity about query performance.
      parameters:
        - $ref: '#/components/parameters/x-request-id'
      tags:
        - Statistics
    parameters:
      - $ref: '#/components/parameters/datamart'
      - $ref: '#/components/parameters/entity'
    post:
      summary: Reset Entity statistics
      operationId: delete-entity-statistics
      responses:
        '200':
          description: OK
          headers:
            x-request-id:
              $ref: '#/components/headers/x-request-id-required'
        '500':
          $ref: '#/components/responses/500'
      description: Reset statistics information of specified entity about query performance.
      tags:
        - Statistics
      parameters:
        - $ref: '#/components/parameters/x-request-id'
components:
  headers:
    x-request-id-required:
      required: true
      schema:
        type: string
      description: An identifier of the response (required)
      example: ee7c7570-1eec-11ed-861d-0242ac120002
  schemas:
    'null':
      title: OpenAPI 3.0 null-type ref
      description: for adding nullability to a ref
      enum:
        - null
    statistics:
      title: statistics
      x-stoplight:
        id: b2qmox9049d0r
      description: Model for statistics
      type: object
      properties:
        entityCatalog:
          type: string
          description: always NULL
          nullable: true
        entitySchema:
          type: string
        entityName:
          type: string
        readCount:
          type: integer
        readDuration:
          type: integer
        readErrorCount:
          type: integer
        firstRead:
          type: string
          nullable: true
        lastRead:
          type: string
          nullable: true
        downloadCount:
          type: integer
        downloadDuration:
          type: integer
        downloadErrorCount:
          type: integer
        firstDownload:
          type: string
          nullable: true
        lastDownload:
          type: string
          nullable: true
        writeCount:
          type: integer
        writeDuration:
          type: integer
        writeErrorCount:
          type: integer
        firstWrite:
          type: string
          nullable: true
        lastWrite:
          type: string
          nullable: true
        uploadCount:
          type: integer
        uploadDuration:
          type: integer
        uploadErrorCount:
          type: integer
        firstUpload:
          type: string
          nullable: true
        lastUpload:
          type: string
          nullable: true
        rowsCount:
          type: integer
          description: 'always NULL for WET, RET'
          nullable: true
        rowsCountDelta:
          type: integer
          description: 'always NULL for WET, RET'
          nullable: true
      required:
        - entityCatalog
        - entitySchema
        - entityName
        - readCount
        - readDuration
        - readErrorCount
        - firstRead
        - lastRead
        - downloadCount
        - downloadDuration
        - downloadErrorCount
        - firstDownload
        - lastDownload
        - writeCount
        - writeDuration
        - writeErrorCount
        - firstWrite
        - lastWrite
        - uploadCount
        - uploadDuration
        - uploadErrorCount
        - firstUpload
        - lastUpload
        - rowsCount
        - rowsCountDelta
    query-request:
      title: query-request
      x-stoplight:
        id: s1dmqlzyaeko7
      type: object
      description: Model for query-request
      properties:
        query:
          type: string
          description: The text of the query
        queryId:
          type: string
          nullable: true
        params:
          type: array
          description: An optional array of parameter values that is used when executing the query in prepared mode
          items:
            type: object
            properties:
              value:
                nullable: true
              type:
                $ref: '#/components/schemas/data-type'
            required:
              - value
              - type
      required:
        - query
    delta:
      type: object
      properties:
        deltaNum:
          type: integer
        deltaDate:
          type: string
        deltaServerDate:
          type: string
        cnFrom:
          type: integer
        cnTo:
          type: integer
      required:
        - deltaNum
        - deltaDate
        - deltaServerDate
        - cnFrom
        - cnTo
      title: delta
      description: Model for delta
    delta-hot:
      title: delta-hot
      x-stoplight:
        id: sciiyc09h9xo2
      type: object
      description: Model for delta-hot
      properties:
        deltaNum:
          type: integer
        cnFrom:
          type: integer
        cnTo:
          type: integer
          nullable: true
        cnMax:
          type: integer
        rollingBack:
          type: boolean
        writeOperationsFinished:
          type: array
          nullable: true
          items:
            type: object
            properties:
              tableName:
                type: string
              cnList:
                type: array
                items:
                  type: integer
            required:
              - tableName
              - cnList
      required:
        - deltaNum
        - cnFrom
        - cnTo
        - cnMax
        - rollingBack
        - writeOperationsFinished
    query-response:
      title: query-response
      x-stoplight:
        id: s8pkbi99hfisv
      type: object
      description: Model for query-response
      properties:
        result:
          type: array
          items:
            type: object
            description: The row as an object with dynamic list of properties according to meta information
        metadata:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                $ref: '#/components/schemas/data-type'
              size:
                type: integer
                nullable: true
              nullable:
                type: boolean
            required:
              - name
              - type
              - size
              - nullable
        rows:
          type: integer
        queryId:
          type: string
          nullable: true
      required:
        - result
        - metadata
        - rows
        - queryId
    data-type:
      title: data-type
      x-stoplight:
        id: v1laoaz7peza7
      type: string
  securitySchemes: {}
  examples: {}
  parameters:
    datamart:
      name: datamart
      in: path
      schema:
        type: string
        example: test_db
      required: true
      description: The logical database on which the request is executed
    entity:
      name: entity
      in: path
      required: true
      schema:
        type: string
        example: test_table
      description: The entity of datamart on which the request is executed
    query-format:
      name: format
      in: query
      required: false
      schema:
        type: string
        enum:
          - json
          - plain
        default: json
      description: Defines the format of query result
    x-request-id:
      name: x-request-id
      in: header
      required: false
      schema:
        type: string
        example: ee7c7570-1eec-11ed-861d-0242ac120002
      description: Parameter providing unique http request identifier (optional)
  requestBodies: {}
  responses:
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              errorMessage:
                type: string
            required:
              - errorMessage
          examples:
            ErrorMessage:
              value:
                errorMessage: error
      headers:
        x-request-id:
          $ref: '#/components/headers/x-request-id-required'
    query:
      description: ResultSet
      content:
        text/plain:
          schema:
            type: string
            description: The result of a request as a plain text
          examples:
            ResultSet:
              value: "id\tname\n0\ttest\n1\ttest1"
            ResultSet (empty):
              value: "id\tname"
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/query-response'
              - type: object
                properties:
                  statistics:
                    type: object
                    required:
                      - elapsedTotalMs
                      - elapsedDbMs
                    properties:
                      elapsedTotalMs:
                        type: integer
                      elapsedDbMs:
                        type: integer
                required:
                  - statistics
          examples:
            ResultSet:
              value:
                result:
                  - name: test
                    id: 0
                  - name: test1
                    id: 1
                metadata:
                  - name: id
                    type: BIGINT
                    size: null
                    nullable: false
                  - name: name
                    type: VARCHAR
                    size: -1
                    nullable: true
                rows: 2
                queryId: '12345'
                statistics:
                  elapsedTotalMs: 34
                  elapsedDbMs: 20
            ResultSet (empty):
              value:
                result: []
                metadata:
                  - name: id
                    type: BIGINT
                    size: null
                    nullable: false
                  - name: name
                    type: VARCHAR
                    size: -1
                    nullable: true
                rows: 0
                queryId: null
                statistics:
                  elapsedTotalMs: 34
                  elapsedDbMs: 20
      headers:
        x-request-id:
          $ref: '#/components/headers/x-request-id-required'
    statistics:
      description: ResultSet
      content:
        application/json:
          schema:
            type: object
            properties:
              statistics:
                type: array
                items:
                  $ref: '#/components/schemas/statistics'
            required:
              - statistics
          examples:
            ResultSet:
              value:
                statistics:
                  - entityCatalog: null
                    entitySchema: testdb
                    entityName: test_table
                    readCount: 1
                    readDuration: 29
                    readErrorCount: 0
                    firstRead: '2022-08-18T06:52:59.643Z'
                    lastRead: '2022-08-18T06:52:59.643Z'
                    downloadCount: 1
                    downloadDuration: 1229
                    downloadErrorCount: 0
                    firstDownload: '2022-08-18T06:54:27.358Z'
                    lastDownload: '2022-08-18T06:54:27.358Z'
                    writeCount: 1
                    writeDuration: 624
                    writeErrorCount: 0
                    firstWrite: '2022-08-18T06:54:15.697Z'
                    lastWrite: '2022-08-18T06:54:15.697Z'
                    uploadCount: 1
                    uploadDuration: 6270
                    uploadErrorCount: 0
                    firstUpload: '2022-08-18T06:52:47.157Z'
                    lastUpload: '2022-08-18T06:52:47.157Z'
                    rowsCount: 16
                    rowsCountDelta: 9
            ResultSet (empty):
              value:
                statistics: []
      headers:
        x-request-id:
          $ref: '#/components/headers/x-request-id-required'
tags:
  - name: SQL+ Query
    description: defines endpoints based on queries in SQL+ format
  - name: Deltas
    description: defines endpoints based on operations with delta
  - name: Schema
    description: defines endpoints based on operations with information schema
  - name: Check
    description: defines endpoints based on check operations
  - name: Statistics
    description: defines endpoints based on statistics operations