AofWessex
AofWessex

Reputation: 157

How to include values dynamically in BigQuery Scheduled Queries Error Message?

I managed to schedule a big query query that tests for equality between two tables (one at the granularity of a linen sheet level, while other is a daily roll up of linen sheet counts).

However, i fail to include the actual value of the variance as the ERROR() argument only expects strings; is there a way to say ERROR('Absolute Variance is {value x} - {value y} = {z} sheets') ?

   CASE WHEN 
    ABS( (sheet_counts.pass - daily_scan.approved_pieces )) >= 1 THEN
    ERROR('Absolute Variance between sheet level and day level counts is greater than 0 for yesterday, Dori - please investigate data flow job to ensure no job failed, Thank you !')
    ELSE 'pass' END AS sheet_daily_match,

Upvotes: 0

Views: 52

Answers (1)

Yun Zhang
Yun Zhang

Reputation: 5503

Are you looking for the FORMAT function?

ERROR(FORMAT('Absolute Variance is %f - %f = %f sheets', x, y, z))

Upvotes: 1

Related Questions