When exclude_txn_from_change_streams is set to true, it prevents read
or write transactions from being tracked in change streams.
If the DDL option allow_txn_exclusion is set to true, then the
updates
made within this transaction aren't recorded in the change stream.
If you don't set the DDL option allow_txn_exclusion or if it's
set to false, then the updates made within this transaction are
recorded in the change stream.
When exclude_txn_from_change_streams is set to false or not set,
modifications from this transaction are recorded in all change streams
that are tracking columns modified by these transactions.
The exclude_txn_from_change_streams option can only be specified
for read-write or partitioned DML transactions, otherwise the API returns
an INVALID_ARGUMENT error.
[[["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-08-28 UTC."],[],[],null,["# Interface TransactionOptionsOrBuilder (6.98.1)\n\nVersion latestkeyboard_arrow_down\n\n- [6.98.1 (latest)](/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.98.0](/java/docs/reference/google-cloud-spanner/6.98.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.97.1](/java/docs/reference/google-cloud-spanner/6.97.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.96.1](/java/docs/reference/google-cloud-spanner/6.96.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.95.1](/java/docs/reference/google-cloud-spanner/6.95.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.94.0](/java/docs/reference/google-cloud-spanner/6.94.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.93.0](/java/docs/reference/google-cloud-spanner/6.93.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.89.0](/java/docs/reference/google-cloud-spanner/6.89.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.88.0](/java/docs/reference/google-cloud-spanner/6.88.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.87.0](/java/docs/reference/google-cloud-spanner/6.87.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.86.0](/java/docs/reference/google-cloud-spanner/6.86.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.85.0](/java/docs/reference/google-cloud-spanner/6.85.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.83.0](/java/docs/reference/google-cloud-spanner/6.83.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.82.0](/java/docs/reference/google-cloud-spanner/6.82.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.80.1](/java/docs/reference/google-cloud-spanner/6.80.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.79.0](/java/docs/reference/google-cloud-spanner/6.79.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.77.0](/java/docs/reference/google-cloud-spanner/6.77.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.74.1](/java/docs/reference/google-cloud-spanner/6.74.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.72.0](/java/docs/reference/google-cloud-spanner/6.72.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.71.0](/java/docs/reference/google-cloud-spanner/6.71.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.69.0](/java/docs/reference/google-cloud-spanner/6.69.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.68.0](/java/docs/reference/google-cloud-spanner/6.68.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.66.0](/java/docs/reference/google-cloud-spanner/6.66.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.65.1](/java/docs/reference/google-cloud-spanner/6.65.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.62.0](/java/docs/reference/google-cloud-spanner/6.62.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.60.0](/java/docs/reference/google-cloud-spanner/6.60.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.58.0](/java/docs/reference/google-cloud-spanner/6.58.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.57.0](/java/docs/reference/google-cloud-spanner/6.57.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.56.0](/java/docs/reference/google-cloud-spanner/6.56.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.55.0](/java/docs/reference/google-cloud-spanner/6.55.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.54.0](/java/docs/reference/google-cloud-spanner/6.54.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.53.0](/java/docs/reference/google-cloud-spanner/6.53.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.52.1](/java/docs/reference/google-cloud-spanner/6.52.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.51.0](/java/docs/reference/google-cloud-spanner/6.51.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.50.1](/java/docs/reference/google-cloud-spanner/6.50.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.49.0](/java/docs/reference/google-cloud-spanner/6.49.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.25.1](/java/docs/reference/google-cloud-spanner/6.25.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.24.0](/java/docs/reference/google-cloud-spanner/6.24.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.23.4](/java/docs/reference/google-cloud-spanner/6.23.4/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.22.0](/java/docs/reference/google-cloud-spanner/6.22.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.21.2](/java/docs/reference/google-cloud-spanner/6.21.2/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.20.0](/java/docs/reference/google-cloud-spanner/6.20.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.19.1](/java/docs/reference/google-cloud-spanner/6.19.1/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.18.0](/java/docs/reference/google-cloud-spanner/6.18.0/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.17.4](/java/docs/reference/google-cloud-spanner/6.17.4/com.google.spanner.v1.TransactionOptionsOrBuilder)\n- [6.14.1](/java/docs/reference/google-cloud-spanner/6.14.1/com.google.spanner.v1.TransactionOptionsOrBuilder) \n\n public interface TransactionOptionsOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### getExcludeTxnFromChangeStreams()\n\n public abstract boolean getExcludeTxnFromChangeStreams()\n\nWhen `exclude_txn_from_change_streams` is set to `true`, it prevents read\nor write transactions from being tracked in change streams.\n\n- If the DDL option `allow_txn_exclusion` is set to `true`, then the\n updates\n made within this transaction aren't recorded in the change stream.\n\n- If you don't set the DDL option `allow_txn_exclusion` or if it's\n set to `false`, then the updates made within this transaction are\n recorded in the change stream.\n\n When `exclude_txn_from_change_streams` is set to `false` or not set,\n modifications from this transaction are recorded in all change streams\n that are tracking columns modified by these transactions.\n\n The `exclude_txn_from_change_streams` option can only be specified\n for read-write or partitioned DML transactions, otherwise the API returns\n an `INVALID_ARGUMENT` error.\n\n`bool exclude_txn_from_change_streams = 5;`\n\n### getIsolationLevel()\n\n public abstract TransactionOptions.IsolationLevel getIsolationLevel()\n\nIsolation level for the transaction.\n\n`.google.spanner.v1.TransactionOptions.IsolationLevel isolation_level = 6;`\n\n### getIsolationLevelValue()\n\n public abstract int getIsolationLevelValue()\n\nIsolation level for the transaction.\n\n`.google.spanner.v1.TransactionOptions.IsolationLevel isolation_level = 6;`\n\n### getModeCase()\n\n public abstract TransactionOptions.ModeCase getModeCase()\n\n### getPartitionedDml()\n\n public abstract TransactionOptions.PartitionedDml getPartitionedDml()\n\nPartitioned DML transaction.\n\nAuthorization to begin a Partitioned DML transaction requires\n`spanner.databases.beginPartitionedDmlTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3;`\n\n### getPartitionedDmlOrBuilder()\n\n public abstract TransactionOptions.PartitionedDmlOrBuilder getPartitionedDmlOrBuilder()\n\nPartitioned DML transaction.\n\nAuthorization to begin a Partitioned DML transaction requires\n`spanner.databases.beginPartitionedDmlTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3;`\n\n### getReadOnly()\n\n public abstract TransactionOptions.ReadOnly getReadOnly()\n\nTransaction does not write.\n\nAuthorization to begin a read-only transaction requires\n`spanner.databases.beginReadOnlyTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadOnly read_only = 2;`\n\n### getReadOnlyOrBuilder()\n\n public abstract TransactionOptions.ReadOnlyOrBuilder getReadOnlyOrBuilder()\n\nTransaction does not write.\n\nAuthorization to begin a read-only transaction requires\n`spanner.databases.beginReadOnlyTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadOnly read_only = 2;`\n\n### getReadWrite()\n\n public abstract TransactionOptions.ReadWrite getReadWrite()\n\nTransaction may write.\n\nAuthorization to begin a read-write transaction requires\n`spanner.databases.beginOrRollbackReadWriteTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadWrite read_write = 1;`\n\n### getReadWriteOrBuilder()\n\n public abstract TransactionOptions.ReadWriteOrBuilder getReadWriteOrBuilder()\n\nTransaction may write.\n\nAuthorization to begin a read-write transaction requires\n`spanner.databases.beginOrRollbackReadWriteTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadWrite read_write = 1;`\n\n### hasPartitionedDml()\n\n public abstract boolean hasPartitionedDml()\n\nPartitioned DML transaction.\n\nAuthorization to begin a Partitioned DML transaction requires\n`spanner.databases.beginPartitionedDmlTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3;`\n\n### hasReadOnly()\n\n public abstract boolean hasReadOnly()\n\nTransaction does not write.\n\nAuthorization to begin a read-only transaction requires\n`spanner.databases.beginReadOnlyTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadOnly read_only = 2;`\n\n### hasReadWrite()\n\n public abstract boolean hasReadWrite()\n\nTransaction may write.\n\nAuthorization to begin a read-write transaction requires\n`spanner.databases.beginOrRollbackReadWriteTransaction` permission\non the `session` resource.\n\n`.google.spanner.v1.TransactionOptions.ReadWrite read_write = 1;`"]]