Skip to content

Commit 0402f4a

Browse files
samples: Modifying BatchSample to add snippet with databoost (#2463)
* samples: Modifying existing samples with data boost * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 12fb011 commit 0402f4a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ implementation 'com.google.cloud:google-cloud-spanner'
5757
If you are using Gradle without BOM, add this to your dependencies:
5858

5959
```Groovy
60-
implementation 'com.google.cloud:google-cloud-spanner:6.42.0'
60+
implementation 'com.google.cloud:google-cloud-spanner:6.42.1'
6161
```
6262

6363
If you are using SBT, add this to your dependencies:
6464

6565
```Scala
66-
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.42.0"
66+
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.42.1"
6767
```
6868
<!-- {x-version-update-end} -->
6969

@@ -412,7 +412,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
412412
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html
413413
[stability-image]: https://img.shields.io/badge/stability-stable-green
414414
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg
415-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.42.0
415+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.42.1
416416
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
417417
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
418418
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

samples/snippets/src/main/java/com/example/spanner/BatchSample.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.cloud.spanner.BatchClient;
2020
import com.google.cloud.spanner.BatchReadOnlyTransaction;
2121
import com.google.cloud.spanner.DatabaseId;
22+
import com.google.cloud.spanner.Options;
2223
import com.google.cloud.spanner.Partition;
2324
import com.google.cloud.spanner.PartitionOptions;
2425
import com.google.cloud.spanner.ResultSet;
@@ -76,10 +77,15 @@ public static void main(String[] args) throws InterruptedException {
7677
batchClient.batchReadOnlyTransaction(TimestampBound.strong());
7778

7879
// A Partition object is serializable and can be used from a different process.
80+
// DataBoost option is an optional parameter which can be used for partition read
81+
// and query to execute the request via spanner independent compute resources.
82+
7983
List<Partition> partitions =
8084
txn.partitionQuery(
8185
PartitionOptions.getDefaultInstance(),
82-
Statement.of("SELECT SingerId, FirstName, LastName FROM Singers"));
86+
Statement.of("SELECT SingerId, FirstName, LastName FROM Singers"),
87+
// Option to enable data boost for a given request
88+
Options.dataBoostEnabled(true));
8389

8490
totalPartitions = partitions.size();
8591

0 commit comments

Comments
 (0)