-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Hello,
I got a small problem. Basically, I just want to receive the names of all the datasets which I can access. My code looks like BigQuery API described how to do it:
import java.util.Iterator;
import java.util.List;
import com.google.api.gax.paging.Page;
//import com.google.appengine.repackaged.org.apache.lucene.analysis.compound.hyphenation.TernaryTree.Iterator;
import com.google.cloud.bigquery.*;
import com.google.cloud.bigquery.BigQuery.DatasetListOption;
public class GetBQInfo {
public static void getinfo (){
BigQuery bigquery = BigQueryOptions.getDefaultInstance()
.toBuilder()
.setProjectId("testprojekt-175408")
.build()
.getService();
String projectId = "testprojekt-175408";
Page<Dataset> datasets = bigquery.listDatasets(projectId, DatasetListOption.pageSize(100));
Iterator<Dataset> datasetIterator = datasets.iterateAll();
while (datasetIterator.hasNext()) {
Dataset dataset = datasetIterator.next();
// do something with the dataset
}
}
}
But I cannot compile the code because I get this message from eclipse:
Type mismatch: cannot convert from Iterable<Dataset> to Iterator<Dataset>
I tried a lot of things but nothing worked for me yet. Does anyone know how I can solve this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.