> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nx1cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Alter tables

> Perform alter operations on a specific table.



## OpenAPI

````yaml patch /api/metastore/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/metastore/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}:
    patch:
      tags:
        - Metastore
      summary: Alter tables
      description: Perform alter operations on a specific table.
      operationId: >-
        alter_table_api_metastore_catalogs__catalog_name__schemas__schema_name__tables__table_name__patch
      parameters:
        - name: catalog_name
          in: path
          required: true
          schema:
            type: string
            description: Catalog name.
            title: Catalog Name
          description: Catalog name.
        - name: schema_name
          in: path
          required: true
          schema:
            type: string
            description: Schema name.
            title: Schema Name
          description: Schema name.
        - name: table_name
          in: path
          required: true
          schema:
            type: string
            description: Table name.
            title: Table Name
          description: Table name.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlterTableRequest'
      responses:
        '200':
          description: Table altered successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlterTableResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlterTableErrorResponse'
          description: Bad Request
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    AlterTableRequest:
      properties:
        operations:
          items:
            $ref: '#/components/schemas/AlterTableOperation'
          type: array
          title: Operations
          description: Ordered list of alter operations to apply
      type: object
      required:
        - operations
      title: AlterTableRequest
    AlterTableResponse:
      properties:
        status:
          type: string
          title: Status
          description: 'The status of the job after completion: `COMPLETED` or `FAILED`.'
        message:
          type: string
          title: Message
          description: >-
            Message describing the completion,partial completion, or failure of
            the execution.
        altered_at:
          type: string
          format: date-time
          title: Altered At
          description: Timestamp of job completion.
      type: object
      required:
        - status
        - message
        - altered_at
      title: AlterTableResponse
    AlterTableErrorResponse:
      properties:
        status:
          type: string
          title: Status
          description: Execution status of the alter table request.
        code:
          type: integer
          title: Code
          description: HTTP status code representing the failure.
        error:
          type: string
          title: Error
          description: Detailed error message from the exception.
        failed_operation_index:
          type: integer
          title: Failed Operation Index
          description: Index of the operation that failed.
        failed_operation:
          type: string
          title: Failed Operation
          description: The operation object that caused the failure.
        altered_at:
          type: string
          format: date-time
          title: Altered At
          description: Timestamp when the failure occurred.
      type: object
      required:
        - status
        - code
        - error
        - failed_operation_index
        - failed_operation
        - altered_at
      title: AlterTableErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AlterTableOperation:
      properties:
        operation:
          $ref: '#/components/schemas/AlterOperationEnum'
          description: Name of the alter operation to perform.
        column_to_delete:
          anyOf:
            - type: string
            - type: 'null'
          title: Column To Delete
          description: Name of the column to delete.
        column_to_add:
          anyOf:
            - type: string
            - type: 'null'
          title: Column To Add
          description: Name of the column to add.
        column_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Column Type
          description: Datatype for the column.
        nullable:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Nullable
          description: Whether the column allows `NULL` values.
        comment:
          anyOf:
            - type: string
            - type: 'null'
          title: Comment
          description: Optional column-level comment.
        old_column_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Old Column Name
          description: Old column name.
        new_column_name:
          anyOf:
            - type: string
            - type: 'null'
          title: New Column Name
          description: New column name.
        column_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Column Name
          description: Column name.
        new_column_type:
          anyOf:
            - type: string
            - type: 'null'
          title: New Column Type
          description: New datatype.
        new_table_name:
          anyOf:
            - type: string
            - type: 'null'
          title: New Table Name
          description: New table name.
      type: object
      required:
        - operation
      title: AlterTableOperation
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    AlterOperationEnum:
      type: string
      enum:
        - add_column
        - alter_column_type
        - drop_column
        - rename_column
        - rename_table
        - truncate_table
      title: AlterOperationEnum
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````