Skip to content

MergeInsertIntoTable

Description

      description: |
        Performs a merge insert (upsert) operation on table `id`.
        This operation updates existing rows
        based on a matching column and inserts new rows that don't match.
        It returns the number of rows inserted and updated.

Request Schema

    MergeInsertIntoTableRequest:
      type: object
      description: |
        Request for merging or inserting records into a table, excluding the Arrow IPC stream.
      properties:
        id:
          type: array
          items:
            type: string
        "on":
          description: Column name to use for matching rows (required)
          type: string
        when_matched_update_all:
          description: Update all columns when rows match
          type: boolean
          default: false
        when_matched_update_all_filt:
          description: The row is updated (similar to UpdateAll) only for rows where the SQL expression evaluates to true
          type: string
        when_not_matched_insert_all:
          description: Insert all columns when rows don't match
          type: boolean
          default: false
        when_not_matched_by_source_delete:
          description: Delete all rows from target table that don't match a row in the source table
          type: boolean
          default: false
        when_not_matched_by_source_delete_filt:
          description: Delete rows from the target table if there is no match AND the SQL expression evaluates to true
          type: string

Response Schema

    MergeInsertIntoTableResponse:
      type: object
      description: Response from merge insert operation
      properties:
        num_updated_rows:
          type: integer
          format: int64
          description: Number of rows updated
          minimum: 0
        num_inserted_rows:
          type: integer
          format: int64
          description: Number of rows inserted
          minimum: 0
        num_deleted_rows:
          type: integer
          format: int64
          description: Number of rows deleted (typically 0 for merge insert)
          minimum: 0
        version:
          type: integer
          format: int64
          description: The commit version associated with the operation
          minimum: 0