Database Reference
In-Depth Information
17"
Waiting on job_1394690025 … (0s) Current status:
DONE
$ bq --job_id=${JOB_ID} query --max_rows=0 "SELECT
17"
BigQuery error in query operation: Already Exists:
Job bigquery-e2e:job_1394690025
The second way to tell whether a job creation operation actually
succeeded is to use the Jobs.get() API to look up the status. If the
job does not exist, you'll get a Not Found error. If the job did run and
has an error, that error will be present in the job status. Next is an
example of running a job that doesn't actually manage to contact
BigQuery because the network is down (we yanked out our network
cable). After the network has been repaired, the command bq show
tells us whether it actually ran. In this case, it did not, so we can retry
the query.
$ JOB_ID=job_$(date +"%s")
$ bq --job_id=${JOB_ID} query --max_rows=0 "SELECT
42"
Network connection problem encountered, please try
again.
Once we plug the network cable back in, we can try again:
$ bq show -j ${JOB_ID}
BigQuery error in show operation: Not Found:
Job bigquery-e2e:job_1394690102
Both the bq command-line client tool and the BigQuery Web UI create
job IDs automatically before starting jobs. The bq tool also has a
mechanism for using a fingerprint of the job to prevent re-execution of
the same job unintentionally. This is discussed in more detail in
Chapter 6, “Loading Data.”
Search WWH ::




Custom Search