Skip to content

Commit 6bcac5f

Browse files
committed
---
yaml --- r: 2563 b: refs/heads/update-datastore c: 6ee866a h: refs/heads/master i: 2561: 282c8b9 2559: f651f83
1 parent 269aeaa commit 6bcac5f

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: bf6a3fe3f05eb488fdbdae7e43519decbfe49ec2
8+
refs/heads/update-datastore: 6ee866a66f32de378fe1d9ae8b5afaccd2013e47
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/gcloud-java-bigquery/README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,23 @@ bigquery.create(DatasetInfo.builder(datasetId).build());
9898

9999
#### Creating a table
100100
With BigQuery you can create different types of tables: normal tables with an associated schema,
101-
external tables backed by data stored on Google Cloud Storage and view tables that are created from
102-
a BigQuery SQL query. In this code snippet we show how to create a normal table with only one string
103-
field. Add the following imports at the top of your file:
101+
external tables backed by data stored on [Google Cloud Storage][cloud-storage] and view tables that
102+
are created from a BigQuery SQL query. In this code snippet we show how to create a normal table
103+
with only one string field. Add the following imports at the top of your file:
104104

105105
```java
106+
import com.google.gcloud.bigquery.BaseTableInfo;
106107
import com.google.gcloud.bigquery.Field;
107108
import com.google.gcloud.bigquery.Schema;
108109
import com.google.gcloud.bigquery.TableId;
109-
import com.google.gcloud.bigquery.BaseTableInfo;
110110
import com.google.gcloud.bigquery.TableInfo;
111111
```
112112
Then add the following code to create the table:
113113

114114
```java
115115
TableId tableId = TableId.of(datasetId, "my_table_id");
116116
// Table field definition
117-
Field stringField = Field.builder("StringField", Field.Type.string())
118-
.mode(Field.Mode.NULLABLE)
119-
.build();
117+
Field stringField = Field.of("StringField", Field.Type.string());
120118
// Table schema definition
121119
Schema schema = Schema.of(stringField);
122120
// Create a table
@@ -172,14 +170,15 @@ Then add the following code to run the query and wait for the result:
172170

173171
```java
174172
// Create a query request
175-
QueryRequest queryRequest = QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
176-
.maxWaitTime(60000L)
177-
.maxResults(1000L)
178-
.build();
173+
QueryRequest queryRequest =
174+
QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
175+
.maxWaitTime(60000L)
176+
.maxResults(1000L)
177+
.build();
179178
// Request query to be executed and wait for results
180179
QueryResponse queryResponse = bigquery.query(queryRequest);
181180
while (!queryResponse.jobComplete()) {
182-
Thread.sleep(1000);
181+
Thread.sleep(1000L);
183182
queryResponse = bigquery.getQueryResults(queryResponse.jobId());
184183
}
185184
// Read rows
@@ -229,9 +228,7 @@ public class GcloudBigQueryExample {
229228

230229
TableId tableId = TableId.of(datasetId, "my_table_id");
231230
// Table field definition
232-
Field stringField = Field.builder("StringField", Field.Type.string())
233-
.mode(Field.Mode.NULLABLE)
234-
.build();
231+
Field stringField = Field.of("StringField", Field.Type.string());
235232
// Table schema definition
236233
Schema schema = Schema.of(stringField);
237234
// Create a table
@@ -255,14 +252,15 @@ public class GcloudBigQueryExample {
255252
}
256253

257254
// Create a query request
258-
QueryRequest queryRequest = QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
259-
.maxWaitTime(60000L)
260-
.maxResults(1000L)
261-
.build();
255+
QueryRequest queryRequest =
256+
QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
257+
.maxWaitTime(60000L)
258+
.maxResults(1000L)
259+
.build();
262260
// Request query to be executed and wait for results
263261
QueryResponse queryResponse = bigquery.query(queryRequest);
264262
while (!queryResponse.jobComplete()) {
265-
Thread.sleep(1000);
263+
Thread.sleep(1000L);
266264
queryResponse = bigquery.getQueryResults(queryResponse.jobId());
267265
}
268266
// Read rows
@@ -275,6 +273,11 @@ public class GcloudBigQueryExample {
275273
}
276274
```
277275

276+
Troubleshooting
277+
---------------
278+
279+
To get help, follow the `gcloud-java` links in the `gcloud-*`[shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting).
280+
278281
Java Versions
279282
-------------
280283

@@ -315,4 +318,5 @@ Apache 2.0 - See [LICENSE] for more information.
315318
[cloud-platform]: https://cloud.google.com/
316319

317320
[cloud-bigquery]: https://cloud.google.com/bigquery/
321+
[cloud-storage]: https://cloud.google.com/storage/
318322
[bigquery-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/bigquery/package-summary.html

0 commit comments

Comments
 (0)