openapi: 3.0.0
info:
  title: IBM Db2 SQL Data Insights REST APIs
  version: 1.1.3
  description: Db2 SQL Data Insights (SQL DI) supports REST services. You can use
    the SQL DI REST APIs to manage certain SQL DI settings and perform common user
    tasks, such as connecting to Db2, creating AI objects, enabling AI query, and
    retraining object models.
servers:
- url: https://localhost:9443
- url: http://localhost:9001
paths:
  /sqldi/v2/token:
    post:
      tags:
      - v2
      summary: Generate a bearer token
      description: Validate user credentials for SQL DI login and return an authorization
        token. The token also contains the requested TTL.
      operationId: createToken
      requestBody:
        description: Login credentials and token settings.
        content:
          application/json:
            schema:
              type: object
              required:
              - username
              - password
              properties:
                username:
                  type: string
                  description: SQL DI username.
                  example: brensone
                password:
                  type: string
                  description: SQL DI password.
                  example: sdan1234
                tokenTTL:
                  type: integer
                  description: Token expiration time in hours. The default is 1 hour.
                  example: 1
        required: true
      responses:
        '201':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJleHAiOjE3MzAyNDIwNjQsImlhdCI6MTczMDIzODQ2NCwiZGlzcGxheV9uYW1lIjoic3lzYWRtIiwiZXhwIjoxNzMwMjc0NDY0Nzk2LCJpYXQiOjE3MzAyMzg0NjQ3OTYsInJvbGUiOiJhZG1pbiIsInVpZCI6InN5FkbV9pZCIsInVzZXJuYW1lIjoic3lzYWRtIn0.SA9qACtMvNRVLBeVG1CLdSf7rfXFOetYu-FI3e5uz_PZpeLC8NF_67U5Ex6UwVQt3PlkXrPrRl0xDC-3CcDyHW34J0NOKiR6lTD_NNL9hVvLgYrALaTvBO5mNgdFfyHgFKH6X1NHLuCeeHMJRXp-i1oQiX-oUr8KGLBy91cd7PCobwFawgDTVqFAJMBnTTcp6usNzzEsz3v1pWeM_ZNdSCGRszDBhQDgGMP8KZFiRwfGi01y46tAeO9OIt3RZEYRFVxw_w-z7tx-wS8Px6blsdwededfPPbwtOTSUEvwL-1YswHhP0aCZp3KAfGWrlhdppf6UeQrDuTMp2OxeQNSseKQ
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: Unable to generate access token.
  /sqldi/v2/encrypt:
    post:
      tags:
      - v2
      summary: Encrypt a password
      operationId: encryptPassword
      requestBody:
        description: The password is encrypted with information in the SQL DI keyring.
        content:
          application/json:
            schema:
              type: object
              required:
              - password
              properties:
                password:
                  type: string
                  description: A SQL DI or Db2 password.
                  example: sdan1234
        required: true
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: bPdSfQSLO7oK0lhvD1SHgrfCXhG/RZQ/JUao2ok+l/r8aO0JDHcYn47Yo0qDS56KEEjQqZ1Rz6bCRdPJf2AlvpGZe91PS8sBQf7ZKOAeRi9XDUI1RfTnY3QJ3XsTEQ1z4754Sgz3YpC9wk8SspkhZbcnUwQjajsfcw9VzdmVkFI3+xtOe7YJuTW85DGTtKBncNGpBwPTROJgVEVruWY9NL+Gg53FFAEM2nsEz/4PRKOTylA80t3YiYW2L1dxPR8DqjdeglXbipKBVtMft8F108CTYhEMCyMsVxs9IBMlsQhZgEFCmTU1IO/o/TMp1HsiL3fj9nGX0favEA01+Rtwkw==
        '400':
          description: Invalid request
          content:
            text/plain:
              examples:
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
  /sqldi/v2/settings:
    get:
      tags:
      - v2
      summary: Get model training settings
      description: Retrieve a list of current model training settings.
      operationId: listSettings
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettingsResponse'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
    patch:
      tags:
      - v2
      summary: Save model training settings
      operationId: saveSettings
      requestBody:
        description: Saving new model training settings overrides the current ones.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SettingsBody'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '201':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: SQL DI settings were saved successfully.
        '400':
          description: Invalid request
          content:
            text/plain:
              examples:
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
                settingError:
                  summary: Invalid settings
                  value: 'Unsupported application setting: <setting>.'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
  /sqldi/v2/settings/default:
    get:
      tags:
      - v2
      summary: Get default SQL DI settings
      description: Retrieve a list of default SQL DI settings.
      operationId: listDefaultSettings
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettingsResponse'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
  /sqldi/v2/connections:
    get:
      tags:
      - v2
      summary: Get connections to a Db2 server
      description: Retrieve a list of all connections to the same Db2 server, including
        connection ID and other details.
      operationId: listConnections
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
    post:
      tags:
      - v2
      summary: Add a connection
      description: Create a new connection from SQL DI to Db2 and return the connection
        ID
      operationId: addConnection
      parameters:
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      requestBody:
        description: Connection details for the new Db2 connection.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionBody'
        required: true
      responses:
        '201':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: 4be52dfd-e561-48d9-a470-3abc824ea67b
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
                connError:
                  summary: Invalid connection details
                  value: Unable to connect to the Db2 instance. Ensure the username,
                    password and other properties are specified correctly.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
  /sqldi/v2/connections/{connId}:
    patch:
      tags:
      - v2
      summary: Edit a connection
      description: Modify a connection from SQL DI to Db2.
      operationId: editConnection
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      requestBody:
        description: Update connection details.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionBody'
        required: true
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              examples:
                success:
                  value: Connection "<name>" is updated successfully for data source
                    type "Db2 v13".
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
                connError:
                  summary: Invalid connection details
                  value: Unable to connect to the Db2 instance. Ensure the username,
                    password and other properties are specified correctly.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
        '404':
          description: The specified connection is not valid or found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
    delete:
      tags:
      - v2
      summary: Remove a connection
      description: Delete a connection from SQL DI to Db2.
      operationId: removeConnection
      parameters:
      - $ref: '#/components/parameters/connId'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: Connection with identifier "<connId>" was deleted successfully.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              schema:
                type: string
                example: The authorization token is invalid.
        '404':
          description: The specified connection is not valid or found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
  /sqldi/v2/connections/{connId}/objects:
    get:
      tags:
      - v2
      summary: Get AI objects for a connection
      description: Retrieve a list of AI objects that are associated with a specific
        connection. If the table name and schema of an object are specified, return
        information specific to that object only.
      operationId: listObjects
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/objectParam'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiObjects'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified object or connection is not found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: No object found
                  value: Object with name <name> cannot be found.
    post:
      tags:
      - v2
      summary: Create and enable an AI object for AI query
      description: Create an AI object, enable the object for AI query, and return
        the object ID.
      operationId: addEnableObject
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      requestBody:
        description: The configuration is used when an object is created and enabled
          for AI query.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrainingConfig'
        required: true
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: Enabling AI query for <name> is in progress.
        '400':
          description: Invalid request
          content:
            text/plain:
              examples:
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
                jsonError:
                  summary: JSON formatting error
                  value: 'Invalid JSON format: <details of format error>.'
                trainingError:
                  summary: Invalid input for model training.
                  value: 'The model training input for <object> is invalid: <details
                    of error>.'
                existingObjectError:
                  summary: Duplicate object
                  value: Object <name> is already enabled or being enabled. To re-enable
                    the object for AI query, you must remove it first.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified connection is not found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Invalid connection ID
                  value: Connection with identifier <connId> not found.
  /sqldi/v2/connections/{connId}/objects/{object}:
    delete:
      tags:
      - v2
      summary: Remove an AI object
      description: Delete an AI object from a connection and all related model tables.
        If the object model is currently being trained, this action terminates the
        training job as well.
      operationId: removeObject
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/object'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: The AI object is successfully removed
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
                objError:
                  summary: Invalid object format
                  value: The object string format is not valid and cannot be parsed.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified object or connection is not found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: Object not found
                  value: Object with name <name> cannot be found.
  /sqldi/v2/connections/{connId}/objects/{object}/config:
    get:
      tags:
      - v2
      summary: Get column configuration for an AI object
      description: Retrieve the column configuration for an AI object in JSON format.
      operationId: getConfiguration
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/object'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ColumnConfig'
        '400':
          description: Invalid request
          content:
            text/plain:
              examples:
                objError:
                  summary: Invalid object format
                  value: The object string format is not valid and cannot be parsed.
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified object or connection is not found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: Object not found
                  value: Object with name <name> could not be found.
  /sqldi/v2/connections/{connId}/objects/{object}/retraining:
    post:
      tags:
      - v2
      summary: Start model retraining
      description: Start model retraining for an AI object and return the training
        job ID.
      operationId: startRetraining
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/object'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: Model retraining is started for <name> successfully.
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                runningError:
                  summary: Model retraining in progress
                  value: Unable to start model retraining. Another training job for
                    <object> is currently in progress.
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
                inelligbleError:
                  summary: Model not elligble for retraining
                  value: The model for <object> is not eligible for retraining.
                objError:
                  summary: Invalid object format
                  value: The object string format is not valid and cannot be parsed.
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified object or connection is not found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: Object not found
                  value: Object with name <name> could not be found.
    delete:
      tags:
      - v2
      summary: Remove a retrained model
      description: Delete a retrained model from an object and related clone tables.
        If model retraining is currently in progress for the object, this action cancels
        the retraining job.
      operationId: removeRetraining
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/object'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: The retrained model is removed successfully.
        '400':
          description: Invalid request.
          content:
            text/plain:
              examples:
                objError:
                  summary: Invalid object format
                  value: The object string format is not valid and cannot be parsed.
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified retrained model, object, or connection is not
            found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: Object not found
                  value: Object with name <name> could not be found.
                retrainError:
                  summary: No retrained model found
                  value: No retrained model is found for <object>.
  /sqldi/v2/connections/{connId}/objects/{object}/retraining/deployment:
    post:
      tags:
      - v2
      summary: Deploy a retrained model
      description: Deploy the retrained model of an AI object into active use.
      operationId: deployModel
      parameters:
      - $ref: '#/components/parameters/connId'
      - $ref: '#/components/parameters/object'
      - $ref: '#/components/parameters/dbUserParam'
      - $ref: '#/components/parameters/dbPasswordParam'
      - $ref: '#/components/parameters/dbEncryptedParam'
      security:
      - bearerAuth: []
      - basicAuth: []
      responses:
        '200':
          description: Success.
          content:
            text/plain:
              schema:
                type: string
                example: The model for object <name> is deployed successfully.
        '400':
          description: Invalid request
          content:
            text/plain:
              examples:
                objError:
                  summary: Invalid object format
                  value: The object string format is not valid and cannot be parsed.
                headerError:
                  summary: Missing required Db2-related headers
                  value: Request is missing required HTTP header '<header>'
        '401':
          description: Unauthorized request.
          content:
            text/plain:
              examples:
                sqldiError:
                  summary: Invalid SQL DI credentials
                  value: The authorization token is invalid.
                db2CredError:
                  summary: Invalid Db2 credentials
                  value: 'Cannot execute SQL with error message: SQLCODE=<code>, Connection
                    authorization failure occurred. Check the SQL DI log for more
                    details.'
        '404':
          description: The specified retrained model, object, or connection is not
            found.
          content:
            text/plain:
              examples:
                connError:
                  summary: Connection not found
                  value: Connection with identifier <connId> not found.
                objError:
                  summary: Object not found
                  value: Object with name <name> could not be found.
                retrainError:
                  summary: No retrained model found
                  value: No retrained model found for object <name>
components:
  schemas:
    ConnectionResponse:
      type: array
      items:
        type: object
        required:
        - createdBy
        - createdDate
        - description
        - hostname
        - id
        - lastUpdatedBy
        - lastUpdatedDate
        - location
        - name
        - port
        - type
        properties:
          createdBy:
            type: string
            description: The SQL DI user ID used to create the connection.
          createdDate:
            type: integer
            description: The date of the connection creation.
          description:
            type: string
            description: Additional information about the connection.
          hostname:
            type: string
            description: The hostname of the connection.
          id:
            type: string
            description: The unique ID of the connection (string).
          lastUpdatedBy:
            type: string
            description: The SQL DI user ID used to make the last update to the connection.
          lastUpdatedDate:
            type: integer
            description: The date of the last connection update.
          location:
            type: string
          name:
            type: string
            description: The name of the connection.
          port:
            type: string
            description: The port of the connection.
          jdbcProperties:
            type: string
          db2SpecialRegisters:
            type: string
          sslCertificate:
            type: string
            description: The SSL certificate in PEM format.
          db2ApplID:
            type: string
            description: The Db2 application name used for passticket generation
          type:
            type: string
        example:
          createdBy: jmckey
          createdDate: 1724171015502
          description: ''
          hostname: TESTSQLDI.IBM.COM
          id: 59fc39d1-f948-4a9c-9c97-d20bda099b71
          lastUpdatedBy: jmckey
          lastUpdatedDate: 1724171015502
          location: ABCDE1
          name: test
          port: 20000,
          type: Db2 v13
    ConnectionBody:
      type: object
      required:
      - description
      - hostname
      - location
      - name
      - port
      properties:
        description:
          type: string
        jdbcProperties:
          type: string
        db2SpecialRegisters:
          type: string
        hostname:
          type: string
          description: The hostname of the connection.
        location:
          type: string
        name:
          type: string
          description: The name of the connection.
        port:
          type: string
          description: The port of the connection.
        sslCertificate:
          type: string
          description: The SSL certificate in PEM format.
        userName:
          type: string
          description: The Db2 user ID for the specified connection.
        password:
          type: string
          description: The Db2 user password for the specified connection.
        db2ApplID:
          type: string
          description: The applid used to generate passtickets for the Db2 connection.
            Subsequent requests that make Db2 connections will generate passtickets
            for the  SQL DI user if Db2 username and password headers are ommited.
      example:
        description: ''
        hostname: TESTSQLDI.IBM.COM
        location: SVLEC4
        name: test_connection
        port: '12001'
        userName: username
        password: password
    AiObjects:
      type: array
      items:
        type: object
        required:
        - description
        - id
        - name
        - objectCreatedDate
        - objectLastUpdatedDate
        - objectStatus
        - objectType
        - schema
        - retrainElligble
        properties:
          description:
            type: string
          id:
            type: integer
          modelId:
            type: integer
          modelLastUpdatedDate:
            type: integer
          modelStatus:
            type: string
            description: 'Possible values: [''Available'', ''Initialized'']'
          name:
            type: string
          objectCreatedDate:
            type: integer
          objectLastUpdatedDate:
            type: integer
          objectStatus:
            type: string
            description: 'Possible values: [''ENABLED'', ''ENABLING'', ''CREATED'',
              ''FAILED'']'
          objectType:
            type: string
          retrainEligible:
            type: boolean
          retrainSection:
            type: object
            description: 'This message contains all retraining information. '
            properties:
              id:
                type: integer
              lastUpdatedDate:
                type: string
              messages:
                type: string
                description: This message explains the model retraining results and
                  contains other related information, such as the output directory
                  for the training job and the spark submit ID.
              retrainStatus:
                type: string
                description: 'Possible values: [''TRAINING'', ''TRAINED'', ''STOPPED'',
                  ''FAILED'', ''ACTIVATING'', ''ACT_FAILED'', ''ACTIVATED'']'
          schema:
            type: string
          trainingJobId:
            type: integer
          trainingLastUpdatedDate:
            type: integer
          trainingMessage:
            type: string
            description: This message explains the results of the training and contains
              other related information like the training directory and spark submit
              ID.
          trainingProgress:
            type: integer
            description: 'Possible values: [0, 100]'
          trainingStatus:
            type: string
            description: 'Possible values: [''Initializing'', ''Failed'', ''Completed''
              ]'
      example:
      - description: ''
        id: 295
        modelId: 315
        modelLastUpdatedDate: 1718741583568
        modelStatus: Available
        name: CHURN_PRIMARY_KEY
        objectCreatedDate: 1717715860106
        objectLastUpdatedDate: 1718741583572
        objectStatus: ENABLED
        objectType: T
        retrainEligible: true
        retrainSection:
          id: 69
          lastUpdatedDate: 1714687008749
          messages: '{"messages":"The retrained model is removed.","sparkSubmitId":"driver-20240502145447-0009"}'
          retrainStatus: STOPPED
        schema: ADMF001
        trainingJobId: 315
        trainingLastUpdatedDate: 1718741583572
        trainingMessage: '{"messages":"Model training is complete","resumeInfo":{"isPrefetchSupported":true,"isRetrainSupported":true,"phase":"completed","trainingFileDirectory":"/sqldi/sqldi-home/temp/training/DSNAIDB_AIDB_ADMF001_CHURN_PRIMARY_KEY_1718741489705"},"sparkSubmitId":"driver-20240618131125-0000"}'
        trainingProgress: 100
        trainingStatus: Completed
    TrainingConfig:
      type: object
      required:
      - configuration
      - schema
      - table
      properties:
        configuration:
          type: object
          required:
          - name
          - keepIdentifierKey
          - columnsConfig
          properties:
            name:
              type: string
              example: cf_for_ADMF001.CHURN
              description: The name of a column configuration.
            keepIdentifierKey:
              type: string
              description: The indicator whether or not a column configuration includes
                a primary key column. The possible values are "Y" and "N" with "N"
                as the default.
              example: N
            neglectValues:
              type: string
              example: ''
              description: The list of user-specified null values from all columns
                that will be ignored for model training.
            columnsConfig:
              type: array
              items:
                type: object
                required:
                - aiSqlType
                - length
                - name
                - sqlType
                properties:
                  neglectValues:
                    type: string
                    example: ''
                    description: The list of user-specified null values from all columns
                      that will be ignored for model training.
                  aiSqlType:
                    type: string
                    example: C
                    description: The SQL DI data type assigned to a column in a column
                      configuration for model training. It can be (C)ategorical, (N)umeric,
                      or (K)ey. SQL DI data type K can be assigned to only one column.
                  length:
                    type: integer
                    example: 30
                    description: The data size of a column.
                  name:
                    type: string
                    example: CUSTOMERID
                    description: The name of a column.
                  sqlType:
                    type: string
                    example: VARCHAR
                    description: The SQL DI data type of a column without the data
                      size.
                  id:
                    type: integer
                    description: The indicator of compatibility with exported column
                      configurations. It's optional.
                  isSelected:
                    type: boolean
                    description: The indicator of compatibility with exported column
                      configurations. It's optional.
                  priority:
                    type: string
                    description: The indicator of compatibility with exported column
                      configurations. It's optional with "H" as the only valid value.
                  scale:
                    type: integer
                    description: The indicator of compatibility with exported column
                      configurations. It's optional.
        schema:
          type: string
          example: ADMF001
          description: The schema of an AI object.
        table:
          type: string
          example: CHURN
          description: The name of an AI object table or view.
        secAuthID:
          type: string
          description: Db2 secondary authorization ID used for object and model management.
      example:
        configuration:
          name: cf_for_ADMF001.CHURN
          keepIdentifierKey: N
          neglectValues: ''
          columnsConfig:
          - neglectValues: ''
            aiSqlType: C
            length: 30
            name: CUSTOMERID
            sqlType: VARCHAR
        schema: ADMF001
        table: CHURN
    ColumnConfig:
      type: object
      required:
      - columnsConfig
      - keepIdentifierKey
      - neglectValues
      properties:
        columnsConfig:
          type: array
          items:
            type: object
            required:
            - aiSqlType
            - id
            - isSelected
            - length
            - name
            - neglectValues
            - priority
            - scale
            - sqlType
            properties:
              aiSqlType:
                type: string
                description: The SQL DI data type assigned to a column in a column
                  configuration for model training. It can be (C)ategorical, (N)umeric,
                  or (K)ey.
              id:
                type: integer
              isSelected:
                type: boolean
                description: The indicator whether or not a column is used for model
                  training.
              length:
                type: integer
                description: The data size of a column.
              name:
                type: string
                description: The name of a column.
              neglectValues:
                type: string
                description: The list of user-specified null values from all columns
                  that will be ignored for model training.
              priority:
                type: string
              scale:
                type: integer
              sqlType:
                type: string
                description: The SQL DI data type of a column without the data size.
        keepIdentifierKey:
          type: string
        neglectValues:
          type: string
      example:
        columnsConfig:
        - aiSqlType: C
          id: 1
          isSelected: true
          length: 20
          name: CONTRACT
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 2
          isSelected: true
          length: 10
          name: DEPENDENTS
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 3
          isSelected: true
          length: 10
          name: PARTNER
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 4
          isSelected: true
          length: 10
          name: SENIORCITIZEN
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 5
          isSelected: true
          length: 10
          name: GENDER
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 6
          isSelected: true
          length: 30
          name: CUSTOMERID
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 7
          isSelected: true
          length: 30
          name: STREAMINGTV
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: N
          id: 8
          isSelected: true
          length: 10
          name: TOTALCHARGES
          neglectValues: ''
          priority: H
          scale: 2
          sqlType: DECIMAL
        - aiSqlType: C
          id: 9
          isSelected: true
          length: 30
          name: PAYMENTMETHOD
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 10
          isSelected: true
          length: 20
          name: STREAMINGMOVIES
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: N
          id: 11
          isSelected: true
          length: 10
          name: MONTHLYCHARGES
          neglectValues: ''
          priority: H
          scale: 2
          sqlType: DECIMAL
        - aiSqlType: C
          id: 12
          isSelected: true
          length: 10
          name: PAPERLESSBILLING
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: N
          id: 13
          isSelected: true
          length: 4
          name: TENURE
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: INTEGER
        - aiSqlType: C
          id: 14
          isSelected: true
          length: 10
          name: PHONESERVICE
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 15
          isSelected: true
          length: 20
          name: MULTIPLELINES
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 16
          isSelected: true
          length: 30
          name: INTERNETSERVICE
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 17
          isSelected: true
          length: 30
          name: ONLINESECURITY
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 18
          isSelected: true
          length: 30
          name: ONLINEBACKUP
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 19
          isSelected: true
          length: 30
          name: DEVICEPROTECTION
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 20
          isSelected: true
          length: 30
          name: TECHSUPPORT
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        - aiSqlType: C
          id: 21
          isSelected: true
          length: 10
          name: CHURN
          neglectValues: ''
          priority: H
          scale: 0
          sqlType: VARCHAR
        keepIdentifierKey: N
        neglectValues: ''
    SettingsResponse:
      type: object
      required:
      - settings
      properties:
        settings:
          type: object
          required:
          - SPARK_DRIVER_CORES
          - SPARK_EXECUTOR_MEMORY
          - BASE10_CLUSTER_THREADS
          - SPARK_DRIVER_MEMORY
          - LOAD_CTL_TEMPLATE
          - TRAINING_THREADS
          - SPARK_EXECUTOR_CORES
          - MAX_QUERY_RECORDS
          properties:
            SPARK_DRIVER_CORES:
              type: string
              example: '1'
              description: The maximum number of spark driver cores that can be used
                for model training. The maximum allowed value is 50.
            SPARK_EXECUTOR_MEMORY:
              type: string
              example: 2G
              description: The maximum amount of memory that can allocated for spark
                executors.
            BASE10_CLUSTER_THREADS:
              type: string
              example: '2'
              description: The maximum number of threads used for data pre-processing.
                The maximum allowed value is 100.
            SPARK_DRIVER_MEMORY:
              type: string
              example: 2G
              description: The maximum amount of memory that can be allocated for
                spark drivers.
            LOAD_CTL_TEMPLATE:
              type: string
              example: "TEMPLATE SORTIN DSN &JO..&ST..SORTIN.T&TIME. UNIT SYSALLDA\
                \ SPACE(100,100) CYL DISP(NEW,DELETE,DELETE) VOLUMES(DUMP04)\nTEMPLATE\
                \ SORTOUT DSN &JO..&ST..SORTOUT.T&TIME. UNIT SYSALLDA SPACE(100,100)\
                \ CYL DISP(NEW,DELETE,DELETE) VOLUMES(DUMP04) \nTEMPLATE MAP1 DSN\
                \ &JO..&ST..MAP1.T&TIME. UNIT SYSALLDA SPACE(100,100) CYL DISP(NEW,DELETE,DELETE)\
                \  VOLUMES(DUMP04)\nLOAD DATA INDDN SYSCLIEN WORKDDN(SORTIN,SORTOUT)\
                \ MAPDDN(MAP1) REPLACE LOG(NO) REUSE NOCOPYPEND \nUNICODE CCSID(1208)"
              description: The template used for the ZLOAD phase after model training
                is complete.
            TRAINING_THREADS:
              type: string
              example: '12'
              description: The maximum number of threads that can be used for model
                training. The maximum allowed value is 100.
            SPARK_EXECUTOR_CORES:
              type: string
              example: '1'
              description: The maximum numbers of spark executor cores that can be
                used for model training. The maximum allowed value is 50.
            MAX_QUERY_RECORDS:
              type: string
              example: '1000'
              description: The maximum number of records that can be queried with
                SQL DI at once. The maximum allowed value is 10000.
    SettingsBody:
      type: object
      required:
      - settings
      properties:
        settings:
          type: object
          properties:
            SPARK_DRIVER_CORES:
              type: string
              example: '1'
              description: The maximum number of spark driver cores that can be used
                for model training. The maximum allowed value is 50.
            SPARK_EXECUTOR_MEMORY:
              type: string
              example: 2G
              description: The maximum amount of memory that can be allocated for
                spark executors.
            BASE10_CLUSTER_THREADS:
              type: string
              example: '2'
              description: The maximum number of threads that can be used for data
                pre-processing. The maximum allowed value is 100.
            SPARK_DRIVER_MEMORY:
              type: string
              example: 2G
              description: The maximum amount of memory that can be allocated for
                spark drivers.
            LOAD_CTL_TEMPLATE:
              type: string
              example: "TEMPLATE SORTIN DSN &JO..&ST..SORTIN.T&TIME. UNIT SYSALLDA\
                \ SPACE(100,100) CYL DISP(NEW,DELETE,DELETE) VOLUMES(DUMP04)\nTEMPLATE\
                \ SORTOUT DSN &JO..&ST..SORTOUT.T&TIME. UNIT SYSALLDA SPACE(100,100)\
                \ CYL DISP(NEW,DELETE,DELETE) VOLUMES(DUMP04) \nTEMPLATE MAP1 DSN\
                \ &JO..&ST..MAP1.T&TIME. UNIT SYSALLDA SPACE(100,100) CYL DISP(NEW,DELETE,DELETE)\
                \  VOLUMES(DUMP04)\nLOAD DATA INDDN SYSCLIEN WORKDDN(SORTIN,SORTOUT)\
                \ MAPDDN(MAP1) REPLACE LOG(NO) REUSE NOCOPYPEND \nUNICODE CCSID(1208)"
              description: The template used for the ZLOAD phase after model training
                is complete.
            TRAINING_THREADS:
              type: string
              example: '12'
              description: The maximum number of threads that can be used for model
                training. The maximum allowed value is 100.
            SPARK_EXECUTOR_CORES:
              type: string
              example: '1'
              description: The maxium number of spark executor cores that can be used
                for model training. The maximum allowed value is 50.
            MAX_QUERY_RECORDS:
              type: string
              example: '1000'
              description: The maximum number of records that can be queried with
                SQL DI at once. The maximum allowed value is 10000.
  parameters:
    connId:
      in: path
      name: connId
      required: true
      schema:
        type: string
      description: The unique ID of a connection. The ID is generated when the connection
        is created.
    object:
      in: path
      name: object
      required: true
      schema:
        type: string
      description: The schema and name of a Db2 resource used for model training.
      example: ADMF001.CHURN
    objectParam:
      in: query
      name: object
      schema:
        type: string
      description: The schema and name of a Db2 resource used for model training.
      example: ADMF001.CHURN
    dbUserParam:
      in: header
      name: Db2-Username
      schema:
        type: string
    dbPasswordParam:
      in: header
      name: Db2-Password
      schema:
        type: string
    dbEncryptedParam:
      in: header
      name: Encrypted
      description: The indicator that the Db2 password used for the connection is
        encrypted. Do not include this flag if the password is not encrypted.
      schema:
        type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    basicAuth:
      type: http
      scheme: basic
      description: The password you specify must be encrypted by using the SQL DI
        REST APIs.
