My Google Application Default Credentials are set to the swast-scratch project, but I wish to list the tables in the publicdata project's samples dataset. This is a public dataset.
$ bq ls publicdata:samples
tableId Type
----------------- -------
github_nested TABLE
github_timeline TABLE
gsod TABLE
natality TABLE
shakespeare TABLE
trigrams TABLE
wikipedia TABLE
Example code that displays this issue:
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.DatasetId;
import com.google.cloud.bigquery.Table;
import java.io.PrintWriter;
import java.util.Iterator;
public class TableLister {
public static void listTables(PrintWriter out) {
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
Iterator<Table> tables = bigquery.listTables(DatasetId.of("publicdata", "samples")).iterateAll();
while (tables.hasNext()) {
out.println(tables.next());
}
}
public static void main(String[] args) {
listTables(new PrintWriter(System.out));
}
}
It fails with the error: "message" : "Not found: Dataset swast-scratch:samples", so it appears that it is not using the project that I set in the DatasetId.
http://googlecloudplatform.github.io/gcloud-java/0.2.5/apidocs/com/google/cloud/bigquery/DatasetId.html#of-java.lang.String-java.lang.String-
My Google Application Default Credentials are set to the swast-scratch project, but I wish to list the tables in the
publicdataproject'ssamplesdataset. This is a public dataset.$ bq ls publicdata:samples tableId Type ----------------- ------- github_nested TABLE github_timeline TABLE gsod TABLE natality TABLE shakespeare TABLE trigrams TABLE wikipedia TABLEExample code that displays this issue:
It fails with the error:
"message" : "Not found: Dataset swast-scratch:samples", so it appears that it is not using the project that I set in the DatasetId.http://googlecloudplatform.github.io/gcloud-java/0.2.5/apidocs/com/google/cloud/bigquery/DatasetId.html#of-java.lang.String-java.lang.String-