Commits a transaction. The request includes the mutations to be applied
to rows in the database. `Commit` might return an `ABORTED` error. This
can occur at any time; commonly, the cause is conflicts with concurrent
transactions. However, it can also happen for a variety of other
reasons. If `Commit` returns `ABORTED`, the caller should retry the
transaction from the beginning, reusing the same session. On very rare
occasions, `Commit` might return `UNKNOWN`. This can happen, for
example, if the client job experiences a 1+ hour networking failure. At
that point, Cloud Spanner has lost track of the transaction outcome and
we recommend that you perform another read from the database to see the
state of things as they are now.

For more information about retries and long-running operations, see
[Understand connectors]().

## Arguments

| Parameters ||
|---|---|
| `session` | `string` Required. The session in which the transaction to be committed is running. |
| `body` | `object (https://cloud.google.com/workflows/docs/reference/googleapis/spanner/v1/Overview#CommitRequest)` Required. |

## Raised exceptions

| Exceptions ||
|---|---|
| `ConnectionError` | In case of a network problem (such as DNS failure or refused connection). |
| `HttpError` | If the response status is \>= 400 (excluding 429 and 503). |
| `TimeoutError` | If a long-running operation takes longer to finish than the specified timeout limit. |
| `TypeError` | If an operation or function receives an argument of the wrong type. |
| `ValueError` | If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout. |

## Response

If successful, the response contains an instance of [`CommitResponse`](https://cloud.google.com/workflows/docs/reference/googleapis/spanner/v1/Overview#CommitResponse).

## Subworkflow snippet

Some fields might be optional or required.
To identify required fields, refer to the [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases.sessions/commit).

### YAML

```yaml
- commit:
    call: googleapis.spanner.v1.projects.instances.databases.sessions.commit
    args:
        session: ...
        body:
            maxCommitDelay: ...
            mutations: ...
            precommitToken:
                precommitToken: ...
                seqNum: ...
            requestOptions:
                priority: ...
                requestTag: ...
                transactionTag: ...
            returnCommitStats: ...
            singleUseTransaction:
                excludeTxnFromChangeStreams: ...
                isolationLevel: ...
                partitionedDml: ...
                readOnly:
                    exactStaleness: ...
                    maxStaleness: ...
                    minReadTimestamp: ...
                    readTimestamp: ...
                    returnReadTimestamp: ...
                    strong: ...
                readWrite:
                    multiplexedSessionPreviousTransactionId: ...
                    readLockMode: ...
            transactionId: ...
    result: commitResult
```

### JSON

```json
[
  {
    "commit": {
      "call": "googleapis.spanner.v1.projects.instances.databases.sessions.commit",
      "args": {
        "session": "...",
        "body": {
          "maxCommitDelay": "...",
          "mutations": "...",
          "precommitToken": {
            "precommitToken": "...",
            "seqNum": "..."
          },
          "requestOptions": {
            "priority": "...",
            "requestTag": "...",
            "transactionTag": "..."
          },
          "returnCommitStats": "...",
          "singleUseTransaction": {
            "excludeTxnFromChangeStreams": "...",
            "isolationLevel": "...",
            "partitionedDml": "...",
            "readOnly": {
              "exactStaleness": "...",
              "maxStaleness": "...",
              "minReadTimestamp": "...",
              "readTimestamp": "...",
              "returnReadTimestamp": "...",
              "strong": "..."
            },
            "readWrite": {
              "multiplexedSessionPreviousTransactionId": "...",
              "readLockMode": "..."
            }
          },
          "transactionId": "..."
        }
      },
      "result": "commitResult"
    }
  }
]
```