In addition to the Data Manipulation Language (DML) based APIs, Cloud Spanner supports the mutation API, where the application describes data modification using a data structure instead of a SQL statement.
This class serves as a wrapper for all mutations types. Use the builders, such as InsertMutationBuilder or UpdateMutationBuilder to create objects of this class.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-22 UTC."],[[["\u003cp\u003eThis webpage provides documentation for the \u003ccode\u003eMutation\u003c/code\u003e class within the Google Cloud Spanner C++ library, which serves as a wrapper for all types of Cloud Spanner mutations.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMutation\u003c/code\u003e class offers an alternative data modification method to DML, allowing users to describe data modifications using data structures, via builders such as \u003ccode\u003eInsertMutationBuilder\u003c/code\u003e or \u003ccode\u003eUpdateMutationBuilder\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation includes various versions of the \u003ccode\u003eMutation\u003c/code\u003e class, ranging from the latest release candidate \u003ccode\u003e2.37.0-rc\u003c/code\u003e down to version \u003ccode\u003e2.11.0\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMutation\u003c/code\u003e class documentation includes details about its constructors, operators, and functions, including \u003ccode\u003eas_proto()\u003c/code\u003e, used for converting the mutation to its underlying proto.\u003c/p\u003e\n"],["\u003cp\u003eThe creation of a \u003ccode\u003eMutation\u003c/code\u003e object is possible, by using the \u003ccode\u003eMutation()\u003c/code\u003e constructor, creating an empty mutation that cannot be used with the Cloud Spanner API, which is further supported by copy and move constructors, and copy and move assignment operators.\u003c/p\u003e\n"]]],[],null,[]]