26
26
import com .google .cloud .bigtable .data .v2 .models .Query ;
27
27
import com .google .cloud .bigtable .data .v2 .models .Row ;
28
28
import com .google .cloud .bigtable .data .v2 .models .RowCell ;
29
+ import com .google .cloud .bigtable .data .v2 .models .TableId ;
29
30
import java .io .IOException ;
30
31
31
32
public class Reads {
@@ -48,7 +49,7 @@ public static void readRow(String projectId, String instanceId, String tableId)
48
49
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
49
50
String rowkey = "phone#4c410523#20190501" ;
50
51
51
- Row row = dataClient .readRow (tableId , rowkey );
52
+ Row row = dataClient .readRow (TableId . of ( tableId ) , rowkey );
52
53
printRow (row );
53
54
54
55
} catch (IOException e ) {
@@ -79,7 +80,7 @@ public static void readRowPartial(String projectId, String instanceId, String ta
79
80
.filter (FILTERS .family ().exactMatch ("stats_summary" ))
80
81
.filter (FILTERS .qualifier ().exactMatch ("os_build" ));
81
82
82
- Row row = dataClient .readRow (tableId , rowkey , filter );
83
+ Row row = dataClient .readRow (TableId . of ( tableId ) , rowkey , filter );
83
84
printRow (row );
84
85
85
86
} catch (IOException e ) {
@@ -104,7 +105,9 @@ public static void readRows(String projectId, String instanceId, String tableId)
104
105
// the "close" method on the client to safely clean up any remaining background resources.
105
106
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
106
107
Query query =
107
- Query .create (tableId ).rowKey ("phone#4c410523#20190501" ).rowKey ("phone#4c410523#20190502" );
108
+ Query .create (TableId .of (tableId ))
109
+ .rowKey ("phone#4c410523#20190501" )
110
+ .rowKey ("phone#4c410523#20190502" );
108
111
ServerStream <Row > rows = dataClient .readRows (query );
109
112
for (Row row : rows ) {
110
113
printRow (row );
@@ -133,7 +136,7 @@ public static void readRowRange(String projectId, String instanceId, String tabl
133
136
// once, and can be reused for multiple requests. After completing all of your requests, call
134
137
// the "close" method on the client to safely clean up any remaining background resources.
135
138
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
136
- Query query = Query .create (tableId ).range (start , end );
139
+ Query query = Query .create (TableId . of ( tableId ) ).range (start , end );
137
140
ServerStream <Row > rows = dataClient .readRows (query );
138
141
for (Row row : rows ) {
139
142
printRow (row );
@@ -160,7 +163,7 @@ public static void readRowRanges(String projectId, String instanceId, String tab
160
163
// the "close" method on the client to safely clean up any remaining background resources.
161
164
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
162
165
Query query =
163
- Query .create (tableId )
166
+ Query .create (TableId . of ( tableId ) )
164
167
.range ("phone#4c410523#20190501" , "phone#4c410523#20190601" )
165
168
.range ("phone#5c10102#20190501" , "phone#5c10102#20190601" );
166
169
ServerStream <Row > rows = dataClient .readRows (query );
@@ -188,7 +191,7 @@ public static void readPrefix(String projectId, String instanceId, String tableI
188
191
// once, and can be reused for multiple requests. After completing all of your requests, call
189
192
// the "close" method on the client to safely clean up any remaining background resources.
190
193
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
191
- Query query = Query .create (tableId ).prefix ("phone" );
194
+ Query query = Query .create (TableId . of ( tableId ) ).prefix ("phone" );
192
195
ServerStream <Row > rows = dataClient .readRows (query );
193
196
for (Row row : rows ) {
194
197
printRow (row );
@@ -215,7 +218,7 @@ public static void readRowsReversed(String projectId, String instanceId, String
215
218
// the "close" method on the client to safely clean up any remaining background resources.
216
219
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
217
220
Query query =
218
- Query .create (tableId )
221
+ Query .create (TableId . of ( tableId ) )
219
222
.reversed (true )
220
223
.limit (3 )
221
224
.prefix ("phone#4c410523" )
@@ -247,7 +250,7 @@ public static void readFilter(String projectId, String instanceId, String tableI
247
250
// once, and can be reused for multiple requests. After completing all of your requests, call
248
251
// the "close" method on the client to safely clean up any remaining background resources.
249
252
try (BigtableDataClient dataClient = BigtableDataClient .create (projectId , instanceId )) {
250
- Query query = Query .create (tableId ).filter (filter );
253
+ Query query = Query .create (TableId . of ( tableId ) ).filter (filter );
251
254
ServerStream <Row > rows = dataClient .readRows (query );
252
255
for (Row row : rows ) {
253
256
printRow (row );
0 commit comments