0

I want to get all the bq history of my own / all user. But I could not find anyway to do it. Anyway to retrieve such log or capture it?

  • I have tried "bq show -j" already but the result does not include original statement / missing arguments.
  • I have tried Stackdriver Logs, it looks similar to bq show with prettyjson argument. So still not the whole command / missing arguments.
TANAKO
  • 11
  • 2
  • 1
    [Click the Link, it can helps you](https://stackoverflow.com/questions/31140104/is-it-possible-to-retrieve-an-extended-or-full-query-history-in-google-bigquery) Hope this will helps you. – Phoenix Jul 03 '19 at 05:04

1 Answers1

0

BigQuery maintains job history for jobs created in the past six months; nonetheless, you could use the 'bq ls' to retrieve the max number of possible results (By default, you are limited to 100,000 results) , as an example, you can use the following command:

bq ls -j -n MAX_RESULTS | wc -l

This command will count the number of jobs in your project, you have to indicate the MAX_RESULTS you expect to get, the default value is 50. Once you obtain the rows you might consider to use the flag --format prettyjson to export your results, as an example:

bq ls -j -n 1000 --format prettyjson

This command will show you the last 1000 jobs made in your project in json format.

The ls command also could lists objects like datasets, tables, views, transfers configuration and transfers history in a collection which could be useful for you.

The Method: jobs.list lists all the jobs that you started in the specified project, the Method: jobs.get returns information about a specific job. In the links you could try those APIs, if they works as you wish you can sue it thru HTTP request or gRPC.

Enrique Zetina
  • 825
  • 5
  • 16