Skip to content
Advertisement

BigQuery can’t find job when using pagination

I’ve been using this AppScript function that I took from here with slight modifications and it seemed to work fine, it just takes in a query and returns a 2D array. However, if the query is big and comes back with more totalRows than rows and therefore requires pagination, the job doesn’t seem to be persistent and therefore I get the following error after the while (queryResults.pageToken):

JavaScript

The job never seems to show up in the job history or using the bq command line tool. Essentially, it’s returning data on the first call but it’s impossible to query that same job more than once as it just disappears.

Here’s my function:

JavaScript

I’ve been adding tons of logs and can confirm that the job is definitely coming back correctly after the first attempt, and that there’s even data in the rows – the issue is simply when there’s a pagination token because totalRows is bigger than rows.

Advertisement

Answer

Turns out I just needed to add location to the last part:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement