Class Mutation (6.111.1)
Stay organized with collections
Save and categorize content based on your preferences.
publicfinalclassMutationimplementsSerializable
Represents an individual table modification to be applied to Cloud Spanner.
The types of mutation that can be created are defined by Op. To construct a mutation,
use one of the builder methods. For example, to create a mutation that will insert a value of "x"
into "C1" and a value of "y" into "C2" of table "T", write the following code:
Mutation m = Mutation.newInsertBuilder("T")
.set("C1").to("x")
.set("C2").to("y")
.build();
Mutations are applied to a database by performing a standalone write or buffering them as part of
a transaction. TODO(user): Add links/code samples once the corresponding APIs are available.
Returns a builder that can be used to construct an Op#INSERT_OR_UPDATE mutation against
table; see the INSERT_OR_UPDATE documentation for mutation semantics.
For all types except Op#DELETE, Op#SEND, and Op#ACK, constructs a map
from column name to value. This is mainly intended as a convenience for testing; direct access
via #getColumns() and #getValues() is more efficient.
For all types except Op#DELETE, Op#SEND, and Op#ACK, returns the values
that this mutation will write. The number of elements returned is always the same as the number
returned by #getColumns(), and the ith value corresponds to the ith
column.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-03-14 UTC."],[],[]]