File tree Expand file tree Collapse file tree
trunk/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
2- refs/heads/master: ca0c26538bb614ba1e34343385ff10ed56e79e0b
2+ refs/heads/master: afe953de798df407060753a591ea0b19e972bf34
33refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
Original file line number Diff line number Diff line change 1818 * A client to Google Cloud BigQuery.
1919 *
2020 * <p>A simple usage example:
21- * <pre>{@code
22- * //TODO(mziccard): add code example
23- * }</pre>
21+ * <pre> {@code
22+ * BigQuery bigquery = BigQueryOptions.defaultInstance().service();
23+ * TableId tableId = TableId.of("dataset", "table");
24+ * BaseTableInfo info = bigquery.getTable(tableId);
25+ * if (info == null) {
26+ * System.out.println("Creating table " + tableId);
27+ * Field integerField = Field.of("fieldName", Field.Type.integer());
28+ * bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
29+ * } else {
30+ * System.out.println("Loading data into table " + tableId);
31+ * LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
32+ * loadJob = bigquery.create(loadJob);
33+ * while (loadJob.status().state() != JobStatus.State.DONE) {
34+ * Thread.sleep(1000L);
35+ * loadJob = bigquery.getJob(loadJob.jobId());
36+ * }
37+ * if (loadJob.status().error() != null) {
38+ * System.out.println("Job completed with errors");
39+ * } else {
40+ * System.out.println("Job succeeded");
41+ * }
42+ * }}</pre>
2443 *
2544 * @see <a href="https://cloud.google.com/bigquery/">Google Cloud BigQuery</a>
2645 */
You can’t perform that action at this time.
0 commit comments