BigQuery - 如何从C#客户端库获取表模式?

时间:2018-02-01 16:29:17

标签: google-bigquery

如何使用C#库加载架构?我在Python上找到了一篇文章,人们可以调用table.reload()来实际加载模式。但我在C#库中找不到任何类似的功能。

BigQueryClient bqClient = BigQueryClient.Create(projectId);
var ds = bqClient.GetDataset(dataset);
var tableList = ds.ListTables();

foreach (var table in ds.ListTables())
{
    //here I need table schema to work on, but schema is null
}

1 个答案:

答案 0 :(得分:2)

我认为你需要这样的东西:

BigQueryClient bqClient = BigQueryClient.Create(projectId);
var ds = bqClient.GetDataset(dataset);
var tableList = ds.ListTables();

foreach (var table in ds.ListTables())
{
    //here I need table schema to work on, but schema is null
    BigQueryTable table = bqClient.GetTable(datasetId, tableId);
    TableSchema schema = table.Schema;
}

请参阅herehere