Skip to content

Commit 9025a31

Browse files
billyjacobsonsduskis
authored andcommitted
---
yaml --- r: 30707 b: refs/heads/autosynth-bigquerydatatransfer c: 55f9f52 h: refs/heads/master i: 30705: 72bb8f2 30703: 97365c2
1 parent 0a139d6 commit 9025a31

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

  • branches/autosynth-bigquerydatatransfer/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ refs/tags/v0.68.0: 9cc799fcf68c82ab431d425fefa58ef615ce8e5b
122122
refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
123123
refs/heads/autosynth-asset: bdb45634a0fe8f7a510692b56b31f5312e25f453
124124
refs/heads/autosynth-automl: 22f9dd5b6f5df8dbfa7da0126864d565229519b2
125-
refs/heads/autosynth-bigquerydatatransfer: 0665d86b4e2da56b40026f5cbd4075e93d03e43c
125+
refs/heads/autosynth-bigquerydatatransfer: 55f9f52990e6749fa4a3f5ba1f49358262820475
126126
refs/heads/autosynth-bigquerystorage: d2c53da3b012e38c662e4df0738042435f19365f
127127
refs/heads/autosynth-bigtable: 9e5429f45cf9face9fed585d0233534993e36b58
128128
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca

branches/autosynth-bigquerydatatransfer/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/HelloWorld.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.google.cloud.examples.bigtable;
1717

18+
// [START bigtable_hw_imports_veneer]
1819
import com.google.api.gax.rpc.NotFoundException;
1920
import com.google.api.gax.rpc.ServerStream;
2021
import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient;
@@ -28,6 +29,8 @@
2829
import com.google.cloud.bigtable.data.v2.models.RowMutation;
2930
import java.io.IOException;
3031

32+
// [END bigtable_hw_imports_veneer]
33+
3134
/**
3235
* An example of using Google Cloud Bigtable.
3336
*
@@ -66,7 +69,7 @@ public static void main(String[] args) throws Exception {
6669
public HelloWorld(String projectId, String instanceId, String tableId) throws IOException {
6770
this.tableId = tableId;
6871

69-
// [START connecting_to_bigtable]
72+
// [START bigtable_hw_connect_veneer]
7073
// Creates the settings to configure a bigtable data client.
7174
BigtableDataSettings settings =
7275
BigtableDataSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId).build();
@@ -83,7 +86,7 @@ public HelloWorld(String projectId, String instanceId, String tableId) throws IO
8386

8487
// Creates a bigtable table admin client.
8588
adminClient = BigtableTableAdminClient.create(adminSettings);
86-
// [END connecting_to_bigtable]
89+
// [END bigtable_hw_connect_veneer]
8790
}
8891

8992
public void run() throws Exception {
@@ -98,7 +101,7 @@ public void run() throws Exception {
98101

99102
/** Demonstrates how to create a table. */
100103
public void createTable() {
101-
// [START creating_a_table]
104+
// [START bigtable_hw_create_table_veneer]
102105
// Checks if table exists, creates table if does not exist.
103106
if (!adminClient.exists(tableId)) {
104107
System.out.println("Creating table: " + tableId);
@@ -107,12 +110,12 @@ public void createTable() {
107110
adminClient.createTable(createTableRequest);
108111
System.out.printf("Table %s created successfully%n", tableId);
109112
}
110-
// [END creating_a_table]
113+
// [END bigtable_hw_create_table_veneer]
111114
}
112115

113116
/** Demonstrates how to write some rows to a table. */
114117
public void writeToTable() {
115-
// [START writing_rows]
118+
// [START bigtable_hw_write_rows_veneer]
116119
try {
117120
System.out.println("\nWriting some greetings to the table");
118121
String[] greetings = {"Hello World!", "Hello Bigtable!", "Hello Java!"};
@@ -126,12 +129,12 @@ public void writeToTable() {
126129
} catch (NotFoundException e) {
127130
System.err.println("Failed to write to non-existent table: " + e.getMessage());
128131
}
129-
// [END writing_rows]
132+
// [END bigtable_hw_write_rows_veneer]
130133
}
131134

132135
/** Demonstrates how to read a single row from a table. */
133136
public void readSingleRow() {
134-
// [START reading_a_row]
137+
// [START bigtable_hw_get_by_key_veneer]
135138
try {
136139
System.out.println("\nReading a single row by row key");
137140
Row row = dataClient.readRow(tableId, ROW_KEY_PREFIX + 0);
@@ -144,12 +147,12 @@ public void readSingleRow() {
144147
} catch (NotFoundException e) {
145148
System.err.println("Failed to read from a non-existent table: " + e.getMessage());
146149
}
147-
// [END reading_a_row]
150+
// [END bigtable_hw_get_by_key_veneer]
148151
}
149152

150153
/** Demonstrates how to read an entire table. */
151154
public void readTable() {
152-
// [START scanning_all_rows]
155+
// [START bigtable_hw_scan_all_veneer]
153156
try {
154157
System.out.println("\nReading the entire table");
155158
Query query = Query.create(tableId);
@@ -165,19 +168,19 @@ public void readTable() {
165168
} catch (NotFoundException e) {
166169
System.err.println("Failed to read a non-existent table: " + e.getMessage());
167170
}
168-
// [END scanning_all_rows]
171+
// [END bigtable_hw_scan_all_veneer]
169172
}
170173

171174
/** Demonstrates how to delete a table. */
172175
public void deleteTable() {
173-
// [START deleting_a_table]
176+
// [START bigtable_hw_delete_table_veneer]
174177
System.out.println("\nDeleting table: " + tableId);
175178
try {
176179
adminClient.deleteTable(tableId);
177180
System.out.printf("Table %s deleted successfully%n", tableId);
178181
} catch (NotFoundException e) {
179182
System.err.println("Failed to delete a non-existent table: " + e.getMessage());
180183
}
181-
// [END deleting_a_table]
184+
// [END bigtable_hw_delete_table_veneer]
182185
}
183186
}

0 commit comments

Comments
 (0)