> ## 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

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/update_records.rs#L56-L71)
pub async fn [update\_records](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/update-records.md#method.update_records)\<T: [KineticaRecord](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md)>( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), expressions: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, new\_values\_maps: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>>>, data: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<T>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Perform predicate-based updates to table dataRuns 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.The records are encoded by the schema of the first.

##### Arguments

<ul>
  <li>`table_name` - 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` - A list of the actual predicates, one for each update; format should follow the guidelines here.</li>
  <li>`new_values_maps` - 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` - The records to send.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/update_records.rs#L119-L143)
pub async fn [update\_records\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/update-records.md#method.update_records_with_opts)\<T: [KineticaRecord](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md)>( \&self, table\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), expressions: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, new\_values\_maps: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[HashMap](https://doc.rust-lang.org/1.98.1/std/collections/hash/map/struct.HashMap.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), [Option](https://doc.rust-lang.org/1.98.1/core/option/enum.Option.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>>>, data: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<T>, options: [UpdateRecordsRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Perform predicate-based updates to table dataRuns 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.The records are encoded by the schema of the first.

##### Arguments

<ul>
  <li>`table_name` - 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` - A list of the actual predicates, one for each update; format should follow the guidelines here.</li>
  <li>`new_values_maps` - 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` - The records to send.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/update_records.rs#L147-L167)
pub async fn [update\_records\_request](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/update-records.md#method.update_records_request)\<T: [KineticaRecord](https://docs.kinetica.com/content/api/rust/trait.KineticaRecord.md)>( \&self, request: &[UpdateRecordsRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsRequest.md)\<T>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`UpdateRecordsRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsRequest) to the `/update/records` endpoint, its records encoded by the schema of the first.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/update_records.rs#L171-L182)
pub async fn [update\_records\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/update-records.md#method.update_records_raw)( \&self, request: &[RawUpdateRecordsRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawUpdateRecordsRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`RawUpdateRecordsRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawUpdateRecordsRequest) to the `/update/records` endpoint, returning the response as the server sends it.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/update_records.rs#L186-L198)
pub async fn [update\_records\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/update-records.md#method.update_records_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[RawUpdateRecordsRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawUpdateRecordsRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[UpdateRecordsResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.UpdateRecordsResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`RawUpdateRecordsRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.RawUpdateRecordsRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


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