Skip to content

Commit

Permalink
update Table javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tangiel committed Sep 17, 2016
1 parent e629b02 commit 98181a5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public Table build() {
* <p>Example of ensuring that a table exists.
* <pre> {@code
* if (!table.exists()) {
* throw new RuntimeException("Table does not exist.");
* throw new RuntimeException("Table does not exist.");
* }
* }</pre>
*
Expand Down Expand Up @@ -344,7 +344,7 @@ public Job copy(String destinationDataset, String destinationTable, JobOption...
* } else {
* // Handle error case.
* }
* } catch(InterruptedException | TimeoutException e) {
* } catch (InterruptedException | TimeoutException e) {
* // Handle interrupted wait.
* }
* }</pre>
Expand All @@ -366,7 +366,7 @@ public Job copy(TableId destinationTable, JobOption... options)
* <p>Example extracting data to single Google Cloud Storage file.
* <pre> {@code
* String format = "CSV";
* String gcsUrl = "gs://bucket_name/filename.csv";
* String gcsUrl = "gs://myapp.appspot.com/filename.csv";
* Job job = table.extract(format, gcsUrl);
*
* // Wait for the job to complete.
Expand All @@ -378,7 +378,7 @@ public Job copy(TableId destinationTable, JobOption... options)
* } else {
* // Handle error case.
* }
* } catch(InterruptedException | TimeoutException e) {
* } catch (InterruptedException | TimeoutException e) {
* // Handle interrupted wait.
* }
* }</pre>
Expand All @@ -401,8 +401,8 @@ public Job extract(String format, String destinationUri, JobOption... options)
* <p>Example extracting data to a list of Google Cloud Storage files.
* <pre> {@code
* String format = "CSV";
* String gcsUrl1 = "gs://bucket_name/PartitionA_*.csv";
* String gcsUrl2 = "gs://bucket_name/PartitionB_*.csv";
* String gcsUrl1 = "gs://myapp.appspot.com/PartitionA_*.csv";
* String gcsUrl2 = "gs://myapp.appspot.com/PartitionB_*.csv";
* List<String> destinationUris = new ArrayList<>();
* destinationUris.add(gcsUrl1);
* destinationUris.add(gcsUrl2);
Expand All @@ -418,7 +418,7 @@ public Job extract(String format, String destinationUri, JobOption... options)
* } else {
* // Handle error case.
* }
* } catch(InterruptedException | TimeoutException e) {
* } catch (InterruptedException | TimeoutException e) {
* // Handle interrupted wait.
* }
* }</pre>
Expand All @@ -440,6 +440,25 @@ public Job extract(String format, List<String> destinationUris, JobOption... opt
* Starts a BigQuery Job to load data into the current table from the provided source URI. Returns
* the started {@link Job} object.
*
* <p>Example loading data from a single Google Cloud Storage file.
* <pre> {@code
* String sourceUri = "gs://myapp.appspot.com/filename.csv";
* Job job = table.load(FormatOptions.csv(), sourceUri);
*
* // Wait for the job to complete.
* try {
* Job completedJob = job.waitFor(WaitForOption.checkEvery(1, TimeUnit.SECONDS),
* WaitForOption.timeout(60, TimeUnit.SECONDS));
* if (completedJob != null && completedJob.status().error() == null) {
* // Job completed successfully.
* } else {
* // Handle error case.
* }
* } catch (InterruptedException | TimeoutException e) {
* // Handle interrupted wait.
* }
* }</pre>
*
* @param format the format of the data to load
* @param sourceUri the fully-qualified Google Cloud Storage URI (e.g. gs://bucket/path) from
* which to load the data
Expand All @@ -455,6 +474,30 @@ public Job load(FormatOptions format, String sourceUri, JobOption... options)
* Starts a BigQuery Job to load data into the current table from the provided source URIs.
* Returns the started {@link Job} object.
*
* <p>Example loading data from a list of Google Cloud Storage files.
* <pre> {@code
* String gcsUrl1 = "gs://myapp.appspot.com/PartitionA_000000000000.csv";
* String gcsUrl2 = "gs://myapp.appspot.com/PartitionB_000000000000.csv";
* List<String> sourceUris = new ArrayList<>();
* sourceUris.add(gcsUrl1);
* sourceUris.add(gcsUrl2);
*
* Job job = table.load(FormatOptions.csv(), sourceUris);
*
* // Wait for the job to complete.
* try {
* Job completedJob = job.waitFor(WaitForOption.checkEvery(1, TimeUnit.SECONDS),
* WaitForOption.timeout(60, TimeUnit.SECONDS));
* if (completedJob != null && completedJob.status().error() == null) {
* // Job completed successfully.
* } else {
* // Handle error case.
* }
* } catch (InterruptedException | TimeoutException e) {
* // Handle interrupted wait.
* }
* }</pre>
*
* @param format the format of the exported data
* @param sourceUris the fully-qualified Google Cloud Storage URIs (e.g. gs://bucket/path) from
* which to load the data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public Job extractSingle(String format, String gcsUrl) {
/**
* Example loading data from a list of Google Cloud Storage files.
*/
// [TARGET load(String, List, JobOption...)]
// [TARGET load(FormatOptions, List, JobOption...)]
// [VARIABLE "gs://myapp.appspot.com/PartitionA_000000000000.csv"]
// [VARIABLE "gs://myapp.appspot.com/PartitionB_000000000000.csv"]
public Job loadList(String gcsUrl1, String gcsUrl2) {
Expand Down Expand Up @@ -304,7 +304,7 @@ public Job loadList(String gcsUrl1, String gcsUrl2) {
/**
* Example loading data from a single Google Cloud Storage file.
*/
// [TARGET load(String, String, JobOption...)]
// [TARGET load(FormatOptions, String, JobOption...)]
// [VARIABLE "gs://myapp.appspot.com/filename.csv"]
public Job loadSingle(String sourceUri) {
// [START loadSingle]
Expand Down

0 comments on commit 98181a5

Please sign in to comment.