This type of transaction is used to execute a single Partitioned DML statement. Partitioned DML partitions the key space and runs the DML statement over each partition in parallel using separate, internal transactions that commit independently.
Chances are, you'll never need to create a partitioned DML transaction directly, instead you'll want to use .
Execute a DML statement and get the affected row count. Unlike after using this method you should immediately discard this transaction, internally it will invoke .
Parameter
Name
Description
query
string |ExecuteSqlRequest
A DML statement or [ExecuteSqlRequest](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.ExecuteSqlRequest) object.
[[["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 2025-09-04 UTC."],[],[],null,["# Class PartitionedDml (7.5.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.5.0 (latest)](/nodejs/docs/reference/spanner/latest/spanner/partitioneddml)\n- [7.4.0](/nodejs/docs/reference/spanner/7.4.0/spanner/partitioneddml)\n- [7.3.0](/nodejs/docs/reference/spanner/7.3.0/spanner/partitioneddml)\n- [7.2.0](/nodejs/docs/reference/spanner/7.2.0/spanner/partitioneddml)\n- [7.1.0](/nodejs/docs/reference/spanner/7.1.0/spanner/partitioneddml)\n- [7.0.0](/nodejs/docs/reference/spanner/7.0.0/spanner/partitioneddml)\n- [6.16.0](/nodejs/docs/reference/spanner/6.16.0/spanner/partitioneddml)\n- [6.15.0](/nodejs/docs/reference/spanner/6.15.0/spanner/partitioneddml)\n- [6.14.0](/nodejs/docs/reference/spanner/6.14.0/spanner/partitioneddml)\n- [6.13.0](/nodejs/docs/reference/spanner/6.13.0/spanner/partitioneddml)\n- [6.12.0](/nodejs/docs/reference/spanner/6.12.0/spanner/partitioneddml)\n- [6.11.0](/nodejs/docs/reference/spanner/6.11.0/spanner/partitioneddml)\n- [6.10.1](/nodejs/docs/reference/spanner/6.10.1/spanner/partitioneddml)\n- [5.15.2](/nodejs/docs/reference/spanner/5.15.2/spanner/partitioneddml)\n- [5.14.0](/nodejs/docs/reference/spanner/5.14.0/spanner/partitioneddml)\n- [5.13.1](/nodejs/docs/reference/spanner/5.13.1/spanner/partitioneddml)\n- [5.12.0](/nodejs/docs/reference/spanner/5.12.0/spanner/partitioneddml)\n- [5.11.1](/nodejs/docs/reference/spanner/5.11.1/spanner/partitioneddml)\n- [5.10.0](/nodejs/docs/reference/spanner/5.10.0/spanner/partitioneddml)\n- [5.9.3](/nodejs/docs/reference/spanner/5.9.3/spanner/partitioneddml)\n- [5.8.1](/nodejs/docs/reference/spanner/5.8.1/spanner/partitioneddml) \nThis type of transaction is used to execute a single Partitioned DML statement. Partitioned DML partitions the key space and runs the DML statement over each partition in parallel using separate, internal transactions that commit independently.\n\nChances are, you'll never need to create a partitioned DML transaction directly, instead you'll want to use .\n\nSnapshot \n\nInheritance\n-----------\n\nDml \\\u003e PartitionedDml\n\nPackage\n-------\n\n[@google-cloud/spanner](../overview.html)\n\nConstructors\n------------\n\n### (constructor)(session, options)\n\n constructor(session: Session, options?: spannerClient.spanner.v1.TransactionOptions.PartitionedDml);\n\nConstructs a new instance of the `PartitionedDml` class\n\nMethods\n-------\n\n### runUpdate(query)\n\n runUpdate(query: string | ExecuteSqlRequest): Promise\u003cRunUpdateResponse\u003e;\n\nExecute a DML statement and get the affected row count. Unlike after using this method you should immediately discard this transaction, internally it will invoke .\n\n**Example** \n\n\n transaction.runUpdate(query, (err, rowRount) =\u003e {\n if (err) {\n // Error handling omitted.\n }\n });\n\n### runUpdate(query, callback)\n\n runUpdate(query: string | ExecuteSqlRequest, callback: RunUpdateCallback): void;"]]