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.



237
238
239
# File 'lib/google/cloud/bigquery/extract_job.rb', line 237

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 ,.



248
249
250
# File 'lib/google/cloud/bigquery/extract_job.rb', line 248

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.



265
266
267
268
# File 'lib/google/cloud/bigquery/extract_job.rb', line 265

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.



277
278
279
# File 'lib/google/cloud/bigquery/extract_job.rb', line 277

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.



294
295
296
# File 'lib/google/cloud/bigquery/extract_job.rb', line 294

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
# File 'lib/google/cloud/bigquery/extract_job.rb', line 225

def location= value
  @gapi.job_reference.location = value
end