0

To handle the errors from bigquery I have used - job.errors[0]['message'] and everything was fine so far.

The issue is when you querying and for example, when you divide the value by 0, BigQuery will show you:

enter image description here

QUESTION: By using PYTHON - HOW to pick up this error?

Community
  • 1
  • 1
Oksana Ok
  • 515
  • 3
  • 7
  • 19

1 Answers1

0

Or, in BigQuery Standard SQL, you can use SAFE_DIVIDE() to avoid error

SAFE_DIVIDE() is equivalent to the division operator (/), but returns NULL if an error occurs, such as a division by zero error

So instead of SELECT 15 / 0 you should use SAFE_DIVIDE(15, 0)

Mikhail Berlyant
  • 165,386
  • 8
  • 154
  • 230