BigQuery list all datasets within project

Asked at 2017-01-11 18:48:21Z
  • 5 Subscribers
  • 114 Views
0

I'm currently trying to construct a query within C# by dynamically querying the tables I need from BigQuery. I found out about a way you can query the project and get all datasets within it but am having a rough time getting it working.

static public List<BigQueryDataset> ListDatasets(BigQueryClient client)
{
    var datasets = client.ListDatasets().ToList();
    return datasets;
}

object datasets = ListDatasets(client);

datasets contains a list/enum of Google.Cloud.BigQuery.V2.BigQueryDataset. I do not know how to get the actual name of the dataset out of this. I'm extremely new to C# and even newer to BigQuery so any help at all would be great. Thanks!


1 answers in total

1
Graham Polley Posted at 2017-01-11 23:27:27Z

Something like this:

[..]
List<BigQueryDataset> datasets = client.ListDatasets().Take(20).ToList();
foreach (BigQueryDataset dataset in datasets){
   Console.WriteLine(dataset.FullyQualifiedId);
}
[..]

See more snippets here.

Answer this questsion