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

# update_records

### update\_records

<ul>
  <li>
    update\_records(\
    &#x20;table\_name: string,\
    &#x20;expressions: string\[],\
    &#x20;new\_values\_maps: Record\<string, string | null>\[],\
    &#x20;data: Record\<string, any>\[],\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md),\
    ): Promise\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsResponse.md)>

    Runs multiple predicate-based updates in a single call. With the list of given expressions, any matching record's column values will be updated as provided in `new_values_maps`. There is also an optional 'upsert' capability where if a particular predicate doesn't match any existing record, then a new record can be inserted.Note that this operation can only be run on an original table and not on a result view\.This operation can update primary key values. By default only 'pure primary key' predicates are allowed when updating primary key values. If the primary key for a table is the column 'attr1', then the operation will only accept predicates of the form: "attr1 == 'foo'" if the attr1 column is being updated. For a composite primary key (e.g. columns 'attr1' and 'attr2') then this operation will only accept predicates of the form: "(attr1 == 'foo') and (attr2 == 'bar')". Meaning, all primary key columns must appear in an equality predicate in the expressions. Furthermore each 'pure primary key' predicate must be unique within a given request. These restrictions can be removed by utilizing some available options through `options`.The update\_on\_existing\_pk option specifies the record primary key collision policy for tables with a primary key, while ignore\_existing\_pk specifies the record primary key collision error-suppression policy when those collisions result in the update being rejected. Both are ignored on tables with no primary key.

    #### Parameters

    <ul>
      <li>
        table\_name: string

        Name of table to be updated, in \[schema\_name.]table\_name format, using standard name resolution rules. Must be a currently existing table and not a view.
      </li>

      <li>
        expressions: string\[]

        A list of the actual predicates, one for each update; format should follow the guidelines `filter`.
      </li>

      <li>
        new\_values\_maps: Record\<string, string | null>\[]

        List of new values for the matching records. Each element is a map with (key, value) pairs where the keys are the names of the columns whose values are to be updated; the values are the new values. The number of elements in the list should match the length of `expressions`.
      </li>

      <li>
        data: Record\<string, any>\[]

        Data records to process
      </li>

      <li>
        `Optional`options: Record\<string, string>

        Optional parameters.
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsResponse.md)>

    Promise\<Types.UpdateRecordsResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:14835](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L14835)</li>
    </ul>
  </li>
</ul>

### update\_records\_request

<ul>
  <li>
    update\_records\_request(\
    &#x20;request: [UpdateRecordsRequest](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsRequest.md),\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md),\
    ): Promise\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsResponse.md)>

    Runs multiple predicate-based updates in a single call. With the list of given expressions, any matching record's column values will be updated as provided in `new_values_maps`. There is also an optional 'upsert' capability where if a particular predicate doesn't match any existing record, then a new record can be inserted.Note that this operation can only be run on an original table and not on a result view\.This operation can update primary key values. By default only 'pure primary key' predicates are allowed when updating primary key values. If the primary key for a table is the column 'attr1', then the operation will only accept predicates of the form: "attr1 == 'foo'" if the attr1 column is being updated. For a composite primary key (e.g. columns 'attr1' and 'attr2') then this operation will only accept predicates of the form: "(attr1 == 'foo') and (attr2 == 'bar')". Meaning, all primary key columns must appear in an equality predicate in the expressions. Furthermore each 'pure primary key' predicate must be unique within a given request. These restrictions can be removed by utilizing some available options through `options`.The update\_on\_existing\_pk option specifies the record primary key collision policy for tables with a primary key, while ignore\_existing\_pk specifies the record primary key collision error-suppression policy when those collisions result in the update being rejected. Both are ignored on tables with no primary key.

    #### Parameters

    <ul>
      <li>
        request: [UpdateRecordsRequest](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsRequest.md)

        Request object containing the parameters for the operation
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/javascript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/javascript/interfaces/UpdateRecordsResponse.md)>

    Promise\<Types.UpdateRecordsResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:14773](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L14773)</li>
    </ul>
  </li>
</ul>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.