0

Using the BigQuery C# API, I can retrieve a list of job IDs:

BigQueryClient  _client = BigQueryClient.Create(...);
...
foreach (var page in _client.ListJobs(projectId).AsRawResponses())
    if (page.Jobs != null)  // This does happen occasionally
        foreach (var job in page.Jobs)
            yield return job.Id;

This seems to give me all jobs ever run (or at least within some significant time horizon; it's tens of thousands of records). Still, I'd like to get the details for some jobs and see if I'm at least on the right track. I can retrieve a BigQueryJob object using BigQueryClient.GetJob() (there's no C# doc, but the Java sample code is similar), but the information returned is very limited: current state, any errors encountered, some basic statistics, etc. There's nothing about schedules.

Is there a separate command to retrieve details on scheduled queries? I can't find any such methods in the client.

Jon of All Trades
  • 5,987
  • 7
  • 48
  • 63

1 Answers1

0

Scheduled queries, and data transfers in general, have a separate API and NuGet package:

Google.Cloud.BigQuery.DataTransfer.V1

Here's how you can get info on scheduled queries using this package:

_client = DataTransferServiceClient.Create();

var request = new ListTransferConfigsRequest(); request.ParentAsProjectName = new ProjectName(projectId); var response = _client.ListTransferConfigs(request);

foreach (var rawTransfer in response) { Guid id = new Guid(rawTransfer.TransferConfigName.TransferConfigId); string name = rawTransfer.DisplayName; bool enabled = !rawTransfer.Disabled; string user = rawTransfer.OwnerInfo?.Email ?? "None"; string schedule = rawTransfer.Schedule; string pubSub = rawTransfer.NotificationPubsubTopic; yield return (id, name, enabled, user, schedule, pubSub); }

Jon of All Trades
  • 5,987
  • 7
  • 48
  • 63