Class: Google::Cloud::Bigquery::ExtractJob
- Defined in:
- lib/google/cloud/bigquery/extract_job.rb
Overview
ExtractJob
A Job subclass representing an export operation that may be performed on a Table. A ExtractJob instance is created when you call Table#extract_job.
Direct Known Subclasses
Defined Under Namespace
Classes: Updater
Instance Method Summary collapse
-
#avro? ⇒ Boolean
Checks if the destination format for the data is Avro.
-
#compression? ⇒ Boolean
Checks if the export operation compresses the data using gzip.
-
#csv? ⇒ Boolean
Checks if the destination format for the data is CSV.
-
#delimiter ⇒ String
The character or symbol the operation uses to delimit fields in the exported data.
-
#destinations ⇒ Object
The URI or URIs representing the Google Cloud Storage files to which the data is exported.
-
#destinations_counts ⇒ Hash<String, Integer>
A hash containing the URI or URI pattern specified in #destinations mapped to the counts of files per destination.
-
#destinations_file_counts ⇒ Array<Integer>
The number of files per destination URI or URI pattern specified in #destinations.
-
#json? ⇒ Boolean
Checks if the destination format for the data is newline-delimited JSON.
-
#print_header? ⇒ Boolean
Checks if the exported data contains a header row.
-
#source ⇒ Table
The table from which the data is exported.
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
#avro? ⇒ Boolean
Checks if the destination format for the data is
Avro. The default is false.
107 108 109 110 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 107 def avro? val = @gapi.configuration.extract.destination_format val == "AVRO" end |
#compression? ⇒ Boolean
Checks if the export operation compresses the data using gzip. The
default is false.
71 72 73 74 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 71 def compression? val = @gapi.configuration.extract.compression val == "GZIP" end |
#csv? ⇒ Boolean
Checks if the destination format for the data is CSV. Tables with
nested or repeated fields cannot be exported as CSV. The default is
true.
95 96 97 98 99 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 95 def csv? val = @gapi.configuration.extract.destination_format return true if val.nil? val == "CSV" end |
#delimiter ⇒ String
The character or symbol the operation uses to delimit fields in the exported data. The default is a comma (,).
118 119 120 121 122 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 118 def delimiter val = @gapi.configuration.extract.field_delimiter val = "," if val.nil? val end |
#destinations ⇒ Object
The URI or URIs representing the Google Cloud Storage files to which the data is exported.
47 48 49 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 47 def destinations Array @gapi.configuration.extract.destination_uris end |
#destinations_counts ⇒ Hash<String, Integer>
A hash containing the URI or URI pattern specified in #destinations mapped to the counts of files per destination.
155 156 157 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 155 def destinations_counts Hash[destinations.zip destinations_file_counts] end |
#destinations_file_counts ⇒ Array<Integer>
The number of files per destination URI or URI pattern specified in #destinations.
144 145 146 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 144 def destinations_file_counts Array @gapi.statistics.extract.destination_uri_file_counts end |
#json? ⇒ Boolean
Checks if the destination format for the data is newline-delimited
JSON. The default is false.
83 84 85 86 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 83 def json? val = @gapi.configuration.extract.destination_format val == "NEWLINE_DELIMITED_JSON" end |
#print_header? ⇒ Boolean
Checks if the exported data contains a header row. The default is
true.
131 132 133 134 135 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 131 def print_header? val = @gapi.configuration.extract.print_header val = true if val.nil? val end |
#source ⇒ Table
The table from which the data is exported. This is the table upon which Table#extract_job was called.
57 58 59 60 61 62 63 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 57 def source table = @gapi.configuration.extract.source_table return nil unless table retrieve_table table.project_id, table.dataset_id, table.table_id end |