You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
46
+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
45
47
-[`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
46
48
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
47
-
-[`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
48
-
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
49
49
-[`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
50
50
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
51
-
-[`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
52
-
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
51
+
-[`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
52
+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
53
53
54
54
Specifying a Project ID
55
55
-----------------------
@@ -109,6 +109,51 @@ Next, choose a method for authenticating API requests from within your project:
109
109
4. Google Cloud SDK credentials
110
110
5. Compute Engine credentials
111
111
112
+
Google Cloud BigQuery
113
+
----------------------
114
+
115
+
- [API Documentation][bigquery-api]
116
+
- [Official Documentation][cloud-bigquery-docs]
117
+
118
+
#### Preview
119
+
120
+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
121
+
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
while (loadJob.status().state() != JobStatus.State.DONE) {
146
+
Thread.sleep(1000L);
147
+
loadJob = bigquery.getJob(loadJob.jobId());
148
+
}
149
+
if (loadJob.status().error() != null) {
150
+
System.out.println("Job completed with errors");
151
+
} else {
152
+
System.out.println("Job succeeded");
153
+
}
154
+
}
155
+
```
156
+
112
157
Google Cloud Datastore
113
158
----------------------
114
159
@@ -149,45 +194,6 @@ if (entity == null) {
149
194
}
150
195
```
151
196
152
-
Google Cloud Storage
153
-
----------------------
154
-
155
-
- [API Documentation][storage-api]
156
-
- [Official Documentation][cloud-storage-docs]
157
-
158
-
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
159
-
160
-
#### Preview
161
-
162
-
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
@@ -219,48 +225,42 @@ while (projectIterator.hasNext()) {
219
225
}
220
226
```
221
227
222
-
Google Cloud BigQuery
228
+
Google Cloud Storage
223
229
----------------------
224
230
225
-
- [API Documentation][bigquery-api]
226
-
- [Official Documentation][cloud-bigquery-docs]
231
+
- [API Documentation][storage-api]
232
+
- [Official Documentation][cloud-storage-docs]
233
+
234
+
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
227
235
228
236
#### Preview
229
237
230
-
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
231
-
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
238
+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
Copy file name to clipboardExpand all lines: gcloud-java-examples/README.md
+27-16Lines changed: 27 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,27 @@ To run examples from your command line:
39
39
40
40
4. Run an example using Maven from command line.
41
41
42
+
Here's an example run of `BigQueryExample`.
43
+
44
+
Before running the example, go to the [Google Developers Console][developers-console] to ensure
45
+
that BigQuery API is enabled. You can upload a CSV file `my_csv_file` to the `my_bucket` bucket
46
+
(replace `my_csv_file` and `my_bucket` with actual file and bucket names) using the GCS
47
+
[web browser](https://console.developers.google.com/storage/browser). The CSV file will be used to
48
+
load data into a BigQuery table and should look something like:
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.BigQueryExample" -Dexec.args="query 'select * from new_dataset_id.new_table_id'"
61
+
```
62
+
42
63
Here's an example run of `DatastoreExample`.
43
64
44
65
Note that you have to enable the Google Cloud Datastore API on the [Google Developers Console][developers-console] before running the following commands.
@@ -48,16 +69,6 @@ To run examples from your command line:
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket. Also ensure that you have a test file (`test.txt` is chosen here) to upload to Cloud Storage stored locally on your machine.
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud BigQuery API is enabled.
83
+
Before running the example, go to the [Google Developers Console][developers-console] to ensure that Google Cloud Storage API is enabled and that you have a bucket. Also ensure that you have a test file (`test.txt` is chosen here) to upload to Cloud Storage stored locally on your machine.
0 commit comments