Class: Gcloud::Bigquery::ExtractJob
- Defined in:
- lib/gcloud/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 Attribute Summary
Attributes inherited from Job
Instance Method Summary collapse
-
#avro? ⇒ Boolean
Checks if the destination format for the data is [Avro](avro.apache.org/).
-
#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](jsonlines.org/).
-
#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?, from_gapi, #initialize, #job_id, #pending?, #project_id, #reload!, #rerun!, #running?, #started_at, #state, #statistics, #status, #wait_until_done!
Constructor Details
This class inherits a constructor from Gcloud::Bigquery::Job
Instance Method Details
#avro? ⇒ Boolean
Checks if the destination format for the data is [Avro](avro.apache.org/). The default is ‘false`.
77 78 79 80 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 77 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`.
52 53 54 55 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 52 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`.
68 69 70 71 72 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 68 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 (,).
85 86 87 88 89 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 85 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.
34 35 36 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 34 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.
112 113 114 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 112 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.
104 105 106 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 104 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](jsonlines.org/). The default is ‘false`.
60 61 62 63 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 60 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`.
94 95 96 97 98 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 94 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.
41 42 43 44 45 46 47 |
# File 'lib/gcloud/bigquery/extract_job.rb', line 41 def source table = @gapi.configuration.extract.source_table return nil unless table retrieve_table table.project_id, table.dataset_id, table.table_id end |