Update BigQuery scheduled query with notificationPubsubTopic fails

235 Views Asked by At

I am using the DataServiceTransferClient API/SDK for Node to create scheduled queries in BigQuery with a notificationPubsubTopic. Creating them works fine, no issues. Updating them results in an error:

INVALID_ARGUMENT: notificationPubsubTopic cannot be updated.

How I'm calling it:

const config = {
transferConfig: {
  /* other config options */
  notificationPubsubTopic: "projects/engineering/topics/test"
},
  updateMask: {
            paths: [
              "params.query",
              "params.write_disposition",
              "params.destination_table_name_template",
              "schedule",
              "notificationPubsubTopic"
            ],
          },
}

dataTransferClient.updateTransferConfig(config)

Some other info:

  • The topics I've tested with do exist. I can update the scheduled query in the UI to these other topic with no issue.
  • Fails even when re-using the already associated topic.
  • Updates without notificationPubsubTopic succeed. By this I specifically mean I am not passing the notificationPubsubTopic property and have removed it from the updateMask.
1

There are 1 best solutions below

0
On

The updateMask property needed to be turned into snakecase.

updateMask: {
            paths: [
              "params.query",
              "params.write_disposition",
              "params.destination_table_name_template",
              "schedule",
              "notification_pubsub_topic" // <--- here
            ],
          },

The documentation even shows an example of using camelCasing

https://cloud.google.com/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.transferConfigs/patch#body.QUERY_PARAMETERS.update_mask