-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from GoogleCloudPlatform/tswast-bq
BigQuery REST samples to label datasets and tables.
- Loading branch information
Showing
8 changed files
with
463 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Getting Started with BigQuery with the REST API | ||
|
||
Google's BigQuery Service features a REST-based API that allows developers to | ||
create applications to run ad-hoc queries on massive datasets. These sample | ||
Java applications demonstrate how to access the BigQuery API directly using the | ||
Google HTTP Client. | ||
|
||
## Quickstart | ||
|
||
Install [Maven](http://maven.apache.org/). | ||
|
||
Build your project with: | ||
|
||
mvn clean package -DskipTests | ||
|
||
You can then run a given `ClassName` via: | ||
|
||
mvn exec:java -Dexec.mainClass=com.example.bigquery.ClassName \ | ||
-Dexec.args="any arguments to the app" | ||
|
||
### Labeling a dataset | ||
|
||
[Label a dataset](https://cloud.google.com/bigquery/docs/labeling-datasets). | ||
|
||
mvn exec:java -Dexec.mainClass=com.example.bigquery.LabelsSample \ | ||
-Dexec.args="project-id dataset-id label-key label-value" | ||
|
||
## Testing | ||
|
||
To run the tests for this sample, first set the `GOOGLE_CLOUD_PROJECT` | ||
environment variable. The project should have a dataset named `test_dataset` | ||
with a table named `test_table`. | ||
|
||
export GOOGLE_CLOUD_PROJECT=my-project | ||
|
||
Then run the tests with Maven. | ||
|
||
mvn clean verify | ||
|
||
## Products | ||
- [Google BigQuery][2] | ||
|
||
## Language | ||
- [Java][3] | ||
|
||
## Dependencies | ||
- [Google HTTP Client Library for Java][4] | ||
|
||
[2]: https://cloud.google.com/bigquery | ||
[3]: https://java.com | ||
[4]: https://github.com/google/google-http-java-client | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<!-- | ||
Copyright 2016 Google Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<version>1.0.0</version> | ||
|
||
<groupId>com.google.cloud.samples</groupId> | ||
<artifactId>bigquery-rest-samples</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<!-- Parent POM defines common plugins and properties. --> | ||
<parent> | ||
<artifactId>doc-samples</artifactId> | ||
<groupId>com.google.cloud</groupId> | ||
<version>1.0.0</version> | ||
<relativePath>../..</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>20.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.api-client</groupId> | ||
<artifactId>google-api-client</artifactId> | ||
<version>1.22.0</version> | ||
<exclusions> | ||
<exclusion> <!-- exclude an old version of Guava --> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava-jdk5</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.http-client</groupId> | ||
<artifactId>google-http-client</artifactId> | ||
<version>1.22.0</version> | ||
<exclusions> | ||
<exclusion> <!-- exclude an old version of Guava --> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava-jdk5</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.oauth-client</groupId> | ||
<artifactId>google-oauth-client</artifactId> | ||
<version>1.22.0</version> | ||
<exclusions> | ||
<exclusion> <!-- exclude an old version of Guava --> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava-jdk5</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.truth</groupId> | ||
<artifactId>truth</artifactId> | ||
<version>0.31</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>src/main/java</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.