class Google::Cloud::Bigquery::ExtractJob
extract_job.done? #=> true
extract_job.wait_until_done!
extract_job = model.extract_job “gs://my-bucket/#{model.model_id}”
model = dataset.model “my_model”
dataset = bigquery.dataset “my_dataset”
bigquery = Google::Cloud::Bigquery.new
require “google/cloud/bigquery”
@example Export a model
extract_job.done? #=> true
extract_job.wait_until_done!
format: “json”
extract_job = table.extract_job “gs://my-bucket/file-name.json”,
table = dataset.table “my_table”
dataset = bigquery.dataset “my_dataset”
bigquery = Google::Cloud::Bigquery.new
require “google/cloud/bigquery”
@example Export table data
reference
@see cloud.google.com/bigquery/docs/reference/v2/jobs Jobs API
Exporting models
@see cloud.google.com/bigquery-ml/docs/exporting-models<br>Exporting table data
@see cloud.google.com/bigquery/docs/exporting-data<br><br>{Project#extract_job}, {Table#extract_job} or {Model#extract_job}.
on a {Table} or {Model}. A ExtractJob instance is returned when you call
A {Job} subclass representing an export operation that may be performed
# ExtractJob
#
def avro?
-
(Boolean)- `true` when `AVRO`, `false` if not `AVRO` or not a
def avro? return false unless table? @gapi.configuration.extract.destination_format == "AVRO" end
def compression?
-
(Boolean)- `true` when `GZIP`, `false` if not `GZIP` or not a
def compression? return false unless table? @gapi.configuration.extract.compression == "GZIP" end
def csv?
-
(Boolean)- `true` when `CSV`, or `false` if not `CSV` or not a
def csv? return false unless table? val = @gapi.configuration.extract.destination_format return true if val.nil? val == "CSV" end
def delimiter
-
(String, nil)- A string containing the character, such as `","`,
def delimiter return unless table? val = @gapi.configuration.extract.field_delimiter val = "," if val.nil? val end
def destinations
The URI or URIs representing the Google Cloud Storage files to which
#
def destinations Array @gapi.configuration.extract.destination_uris end
def destinations_counts
-
(Hash- A Hash with the URI patterns as keys)
def destinations_counts destinations.zip(destinations_file_counts).to_h end
def destinations_file_counts
-
(Array- An array of values in the same order as the)
def destinations_file_counts Array @gapi.statistics.extract.destination_uri_file_counts end
def json?
-
(Boolean)- `true` when `NEWLINE_DELIMITED_JSON`, `false` if not
def json? return false unless table? @gapi.configuration.extract.destination_format == "NEWLINE_DELIMITED_JSON" end
def ml_tf_saved_model?
-
(Boolean)- `true` when `ML_TF_SAVED_MODEL`, `false` if not
def ml_tf_saved_model? return false unless model? val = @gapi.configuration.extract.destination_format return true if val.nil? val == "ML_TF_SAVED_MODEL" end
def ml_xgboost_booster?
-
(Boolean)- `true` when `ML_XGBOOST_BOOSTER`, `false` if not
def ml_xgboost_booster? return false unless model? @gapi.configuration.extract.destination_format == "ML_XGBOOST_BOOSTER" end
def model?
-
(Boolean)- `true` when the source is a model, `false`
def model? !@gapi.configuration.extract.source_model.nil? end
def print_header?
-
(Boolean)- `true` when the print header configuration is
def print_header? return false unless table? val = @gapi.configuration.extract.print_header val = true if val.nil? val end
def retrieve_model project_id, dataset_id, model_id
def retrieve_model project_id, dataset_id, model_id ensure_service! gapi = service.get_project_model project_id, dataset_id, model_id Model.from_gapi_json gapi, service rescue Google::Cloud::NotFoundError nil end
def source view: nil
-
(Table, Model, nil)- A table or model instance, or `nil`.
Parameters:
-
view(String) -- Specifies the view that determines which table information is returned.
def source view: nil if (table = @gapi.configuration.extract.source_table) retrieve_table table.project_id, table.dataset_id, table.table_id, metadata_view: view elsif (model = @gapi.configuration.extract.source_model) retrieve_model model.project_id, model.dataset_id, model.model_id end end
def table?
-
(Boolean)- `true` when the source is a table, `false`
def table? !@gapi.configuration.extract.source_table.nil? end
def use_avro_logical_types?
-
(Boolean)- `true` when applicable column types will use their
def use_avro_logical_types? return false unless table? @gapi.configuration.extract.use_avro_logical_types end