loki
loki

Reputation: 972

GCP BigQuery - Verify successful execution of stored procedure

I have a BigQuery routine that inserts records into a BQ Table. I am looking to have a Eventarc trigger that triggers Cloud Run, and performs some action on successful execution of the BigQuery Routine.

From Cloud Logging, I can see two events that would seem to confirm the successful execution of the BQ Routine. protoPayload.methodName="google.cloud.bigquery.v2.JobService.InsertJob"

protoPayload.metadata.tableDataChange.insertedRowsCount

However, this does not give me the Job ID.

So, I am looking at event -
protoPayload.methodName="jobservice.jobcompleted"

Would it be correct to assume that, if protoPayload.serviceData.jobCompletedEvent.job.jobStatus.error is empty, then the stored procedure execution was successful?

Thanks!

Upvotes: 1

Views: 1077

Answers (1)

loki
loki

Reputation: 972

Decided to go with protoPayload.methodName="jobservice.jobcompleted" in this case. It gives the job id at protoPayload.requestMetadata.resourceName, status like protoPayload.serviceData.jobCompletedEvent.job.jobStatus.state and errors if any like protoPayload.serviceData.jobCompletedEvent.job.jobStatus.error

Upvotes: 0

Related Questions