Class: Google::Cloud::Bigquery::ExtractJob::Updater

Inherits:
Google::Cloud::Bigquery::ExtractJob show all
Defined in:
lib/google/cloud/bigquery/extract_job.rb

Overview

Yielded to a block to accumulate changes for an API request.

Attributes collapse

Methods inherited from Google::Cloud::Bigquery::ExtractJob

#avro?, #compression?, #csv?, #delimiter, #destinations, #destinations_counts, #destinations_file_counts, #json?, #print_header?, #source

Methods inherited from Job

#cancel, #configuration, #created_at, #done?, #ended_at, #error, #errors, #failed?, #job_id, #labels, #location, #pending?, #project_id, #reload!, #rerun!, #running?, #started_at, #state, #statistics, #status, #user_email, #wait_until_done!

Instance Method Details

#compression=(value) ⇒ Object

Sets the compression type.

Parameters:

  • value (String)

    The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.



242
243
244
# File 'lib/google/cloud/bigquery/extract_job.rb', line 242

def compression= value
  @gapi.configuration.extract.compression = value
end

#delimiter=(value) ⇒ Object

Sets the field delimiter.

Parameters:

  • value (String)

    Delimiter to use between fields in the exported data. Default is ,.



253
254
255
# File 'lib/google/cloud/bigquery/extract_job.rb', line 253

def delimiter= value
  @gapi.configuration.extract.field_delimiter = value
end

#format=(new_format) ⇒ Object

Sets the destination file format. The default value is csv.

The following values are supported:

Parameters:

  • new_format (String)

    The new source format.



270
271
272
273
# File 'lib/google/cloud/bigquery/extract_job.rb', line 270

def format= new_format
  @gapi.configuration.extract.update! destination_format:
    Convert.source_format(new_format)
end

#header=(value) ⇒ Object

Print a header row in the exported file.

Parameters:

  • value (Boolean)

    Whether to print out a header row in the results. Default is true.



282
283
284
# File 'lib/google/cloud/bigquery/extract_job.rb', line 282

def header= value
  @gapi.configuration.extract.print_header = value
end

#labels=(value) ⇒ Object

Sets the labels to use for the job.

Parameters:

  • value (Hash)

    A hash of user-provided labels associated with the job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.



299
300
301
# File 'lib/google/cloud/bigquery/extract_job.rb', line 299

def labels= value
  @gapi.configuration.update! labels: value
end

#location=(value) ⇒ Object

Sets the geographic location where the job should run. Required except for US and EU.

Examples:

require "google/cloud/bigquery"

bigquery = Google::Cloud::Bigquery.new
dataset = bigquery.dataset "my_dataset"
table = dataset.table "my_table"

destination = "gs://my-bucket/file-name.csv"
extract_job = table.extract_job destination do |j|
  j.location = "EU"
end

extract_job.wait_until_done!
extract_job.done? #=> true

Parameters:

  • value (String)

    A geographic location, such as "US", "EU" or "asia-northeast1". Required except for US and EU.



225
226
227
228
229
230
231
232
# File 'lib/google/cloud/bigquery/extract_job.rb', line 225

def location= value
  @gapi.job_reference.location = value
  return unless value.nil?

  # Treat assigning value of nil the same as unsetting the value.
  unset = @gapi.job_reference.instance_variables.include? :@location
  @gapi.job_reference.remove_instance_variable :@location if unset
end