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.
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 ⇒ Object
The 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 ⇒ Object
The count of files per destination URI or URI pattern specified in #destinations.
-
#destinations_file_counts ⇒ Object
The count 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 ⇒ Object
The table from which the data is exported.
Methods inherited from Job
#configuration, #created_at, #done?, #ended_at, #error, #errors, #failed?, #job_id, #pending?, #project_id, #reload!, #rerun!, #running?, #started_at, #state, #statistics, #status, #wait_until_done!
Instance Method Details
#avro? ⇒ Boolean
Checks if the destination format for the data is
Avro. The default is false.
79 80 81 82 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 79 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.
53 54 55 56 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 53 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.
70 71 72 73 74 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 70 def csv? val = @gapi.configuration.extract.destination_format return true if val.nil? val == "CSV" end |
#delimiter ⇒ Object
The symbol the operation uses to delimit fields in the exported data. The default is a comma (,).
87 88 89 90 91 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 87 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.
35 36 37 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 35 def destinations Array @gapi.configuration.extract.destination_uris end |
#destinations_counts ⇒ Object
The count of files per destination URI or URI pattern specified in #destinations. Returns a Hash with the URI patterns as keys and the counts as values.
114 115 116 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 114 def destinations_counts Hash[destinations.zip destinations_file_counts] end |
#destinations_file_counts ⇒ Object
The count of files per destination URI or URI pattern specified in #destinations. Returns an Array of values in the same order as the URI patterns.
106 107 108 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 106 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.
61 62 63 64 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 61 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.
96 97 98 99 100 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 96 def print_header? val = @gapi.configuration.extract.print_header val = true if val.nil? val end |
#source ⇒ Object
The table from which the data is exported. This is the table upon which Table#extract was called. Returns a Table instance.
42 43 44 45 46 47 48 |
# File 'lib/google/cloud/bigquery/extract_job.rb', line 42 def source table = @gapi.configuration.extract.source_table return nil unless table retrieve_table table.project_id, table.dataset_id, table.table_id end |