lib/google/cloud/bigquery/job.rb in google-cloud-bigquery-0.24.0 vs lib/google/cloud/bigquery/job.rb in google-cloud-bigquery-0.25.0
- old
+ new
@@ -42,12 +42,12 @@
# @example
# require "google/cloud/bigquery"
#
# bigquery = Google::Cloud::Bigquery.new
#
- # q = "SELECT COUNT(word) as count FROM publicdata:samples.shakespeare"
- # job = bigquery.query_job q
+ # job = bigquery.query_job "SELECT COUNT(word) as count FROM " \
+ # "publicdata.samples.shakespeare"
#
# job.wait_until_done!
#
# if job.failed?
# puts job.error
@@ -201,9 +201,18 @@
# The errors for the job, if any errors have occurred. Returns an array
# of hash objects. See {#error}.
def errors
return [] if @gapi.status.nil?
Array(@gapi.status.errors).map { |e| JSON.parse e.to_json }
+ end
+
+ ##
+ # Cancels the job.
+ def cancel
+ ensure_service!
+ resp = service.cancel_job job_id
+ @gapi = resp.job
+ true
end
##
# Created a new job with the current configuration.
def rerun!