class Google::Cloud::Bigquery::LoadJob
load_job.done? #=> true
load_job.wait_until_done!
end
end
nested_schema.integer “number_of_years”, mode: :required
nested_schema.string “place”, mode: :required
schema.record “cities_lived”, mode: :repeated do |nested_schema|
schema.string “first_name”, mode: :required
load_job = dataset.load_job “my_new_table”, gcs_uri do |schema|
gcs_uri = “gs://my-bucket/file-name.csv”
dataset = bigquery.dataset “my_dataset”
bigquery = Google::Cloud::Bigquery.new
require “google/cloud/bigquery”
@example
reference
@see cloud.google.com/bigquery/docs/reference/v2/jobs Jobs API
Loading Data Into BigQuery
@see cloud.google.com/bigquery/loading-data<br><br>{Table#load_job}.
on a {Table}. A LoadJob instance is created when you call
A {Job} subclass representing a load operation that may be performed
# LoadJob
#
def allow_jagged_rows?
-
(Boolean)- `true` when jagged rows are allowed, `false`
def allow_jagged_rows? val = @gapi.configuration.load.allow_jagged_rows val = false if val.nil? val end
def autodetect?
-
(Boolean)- `true` when autodetect is enabled, `false`
def autodetect? val = @gapi.configuration.load.autodetect val = false if val.nil? val end
def backup?
-
(Boolean)- `true` when the source format is `DATASTORE_BACKUP`,
def backup? @gapi.configuration.load.source_format == "DATASTORE_BACKUP" end
def clustering?
-
(Boolean)- `true` when the table will be clustered,
Other tags:
- See: https://cloud.google.com/bigquery/docs/creating-clustered-tables -
See: https://cloud.google.com/bigquery/docs/clustered-tables -
def clustering? !@gapi.configuration.load.clustering.nil? end
def clustering_fields
-
(Array- The clustering fields, or `nil` if the, nil)
Other tags:
- See: https://cloud.google.com/bigquery/docs/creating-clustered-tables -
See: https://cloud.google.com/bigquery/docs/clustered-tables -
def clustering_fields @gapi.configuration.load.clustering.fields if clustering? end
def csv?
-
(Boolean)- `true` when the source format is `CSV`, `false`
def csv? val = @gapi.configuration.load.source_format return true if val.nil? val == "CSV" end
def date_format
-
(String, nil)- The date format pattern, such as
def date_format @gapi.configuration.load.date_format end
def datetime_format
-
(String, nil)- The datetime format pattern, such as
def datetime_format @gapi.configuration.load.datetime_format end
def delimiter
-
(String)- A string containing the character, such as `","`.
def delimiter @gapi.configuration.load.field_delimiter || "," end
def destination view: nil
-
(Table)- A table instance.
Parameters:
-
view(String) -- Specifies the view that determines which table information is returned.
def destination view: nil table = @gapi.configuration.load.destination_table return nil unless table retrieve_table table.project_id, table.dataset_id, table.table_id, metadata_view: view end
def encryption
-
(Google::Cloud::BigQuery::EncryptionConfiguration)- Custom
def encryption EncryptionConfiguration.from_gapi( @gapi.configuration.load.destination_encryption_configuration ) end
def hive_partitioning?
-
(Boolean)- `true` when hive partitioning options are set, or `false` otherwise.
Other tags:
- See: https://cloud.google.com/bigquery/docs/hive-partitioned-loads-gcs - Loading externally partitioned data
def hive_partitioning? !@gapi.configuration.load.hive_partitioning_options.nil? end
def hive_partitioning_mode
-
(String, nil)- The mode of hive partitioning, or `nil` if not set.
Other tags:
- See: https://cloud.google.com/bigquery/docs/hive-partitioned-loads-gcs - Loading externally partitioned data
def hive_partitioning_mode @gapi.configuration.load.hive_partitioning_options.mode if hive_partitioning? end
def hive_partitioning_source_uri_prefix
-
(String, nil)- The common prefix for all source uris, or `nil` if not set.
Other tags:
- See: https://cloud.google.com/bigquery/docs/hive-partitioned-loads-gcs - Loading externally partitioned data
def hive_partitioning_source_uri_prefix @gapi.configuration.load.hive_partitioning_options.source_uri_prefix if hive_partitioning? end
def ignore_unknown_values?
-
(Boolean)- `true` when unknown values are ignored, `false`
def ignore_unknown_values? val = @gapi.configuration.load.ignore_unknown_values val = false if val.nil? val end
def input_file_bytes
-
(Integer)- The number of bytes.
def input_file_bytes Integer @gapi.statistics.load.input_file_bytes rescue StandardError nil end
def input_files
-
(Integer)- The number of source files.
def input_files Integer @gapi.statistics.load.input_files rescue StandardError nil end
def iso8859_1?
-
(Boolean)- `true` when the character encoding is ISO-8859-1,
def iso8859_1? @gapi.configuration.load.encoding == "ISO-8859-1" end
def json?
-
(Boolean)- `true` when the source format is
def json? @gapi.configuration.load.source_format == "NEWLINE_DELIMITED_JSON" end
def max_bad_records
-
(Integer)- The maximum number of bad records.
def max_bad_records val = @gapi.configuration.load.max_bad_records val = 0 if val.nil? val end
def null_marker
-
(String)- A string representing null value in a CSV file.
def null_marker val = @gapi.configuration.load.null_marker val = "" if val.nil? val end
def null_markers
-
(Array- The array of null marker strings.)
def null_markers @gapi.configuration.load.null_markers || [] end
def orc?
-
(Boolean)- `true` when the source format is `ORC`,
def orc? @gapi.configuration.load.source_format == "ORC" end
def output_bytes
-
(Integer)- The number of bytes that have been loaded.
def output_bytes Integer @gapi.statistics.load.output_bytes rescue StandardError nil end
def output_rows
-
(Integer)- The number of rows that have been loaded.
def output_rows Integer @gapi.statistics.load.output_rows rescue StandardError nil end
def parquet?
-
(Boolean)- `true` when the source format is `PARQUET`,
def parquet? @gapi.configuration.load.source_format == "PARQUET" end
def parquet_enable_list_inference?
-
(Boolean, nil)- The `enable_list_inference` value in Parquet options, or `nil` if Parquet options are
Other tags:
- See: https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-parquet - Loading Parquet data from Cloud
def parquet_enable_list_inference? @gapi.configuration.load.parquet_options.enable_list_inference if parquet_options? end
def parquet_enum_as_string?
-
(Boolean, nil)- The `enum_as_string` value in Parquet options, or `nil` if Parquet options are not set.
Other tags:
- See: https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-parquet - Loading Parquet data from Cloud
def parquet_enum_as_string? @gapi.configuration.load.parquet_options.enum_as_string if parquet_options? end
def parquet_options?
-
(Boolean)- `true` when Parquet options are set, or `false` otherwise.
Other tags:
- See: https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-parquet - Loading Parquet data from Cloud
def parquet_options? !@gapi.configuration.load.parquet_options.nil? end
def preserve_ascii_control_characters
-
(Boolean, nil)- whether or not ASCII control characters are
def preserve_ascii_control_characters @gapi.configuration.load.preserve_ascii_control_characters end
def quote
-
(String)- A string containing the character, such as `"\""`.
def quote val = @gapi.configuration.load.quote val = "\"" if val.nil? val end
def quoted_newlines?
-
(Boolean)- `true` when quoted newlines are allowed, `false`
def quoted_newlines? val = @gapi.configuration.load.allow_quoted_newlines val = false if val.nil? val end
def range_partitioning?
-
(Boolean)- `true` when the table is range partitioned, or `false` otherwise.
def range_partitioning? !@gapi.configuration.load.range_partitioning.nil? end
def range_partitioning_end
-
(Integer, nil)- The end of range partitioning, exclusive, or `nil` if not range partitioned.
def range_partitioning_end @gapi.configuration.load.range_partitioning.range.end if range_partitioning? end
def range_partitioning_field
-
(String, nil)- The partition field, if a field was configured, or `nil` if not range partitioned.
def range_partitioning_field @gapi.configuration.load.range_partitioning.field if range_partitioning? end
def range_partitioning_interval
-
(Integer, nil)- The width of each interval, for data in range partitions, or `nil` if not range
def range_partitioning_interval return nil unless range_partitioning? @gapi.configuration.load.range_partitioning.range.interval end
def range_partitioning_start
-
(Integer, nil)- The start of range partitioning, inclusive, or `nil` if not range partitioned.
def range_partitioning_start @gapi.configuration.load.range_partitioning.range.start if range_partitioning? end
def reference_file_schema_uri
-
(String, nil)- The URI of the reference file, or `nil` if not set.
def reference_file_schema_uri @gapi.configuration.load.reference_file_schema_uri end
def schema
-
(Schema, nil)- A schema object, or `nil`.
def schema Schema.from_gapi(@gapi.configuration.load.schema).freeze end
def schema_update_options
-
(Array- An array of strings.)
def schema_update_options Array @gapi.configuration.load.schema_update_options end
def skip_leading_rows
-
(Integer)- The number of header rows at the top of a CSV file
def skip_leading_rows @gapi.configuration.load.skip_leading_rows || 0 end
def source_column_match
-
(String, nil)- The source column match strategy, such as
def source_column_match @gapi.configuration.load.source_column_match end
def sources
The URI or URIs representing the Google Cloud Storage files from which
#
def sources Array @gapi.configuration.load.source_uris end
def time_format
-
(String, nil)- The time format pattern, such as
def time_format @gapi.configuration.load.time_format end
def time_partitioning?
-
(Boolean)- `true` when the table will be time-partitioned,
def time_partitioning? !@gapi.configuration.load.time_partitioning.nil? end
def time_partitioning_expiration
-
(Integer, nil)- The expiration time, in seconds, for data in
def time_partitioning_expiration return nil unless time_partitioning? return nil if @gapi.configuration.load.time_partitioning.expiration_ms.nil? @gapi.configuration.load.time_partitioning.expiration_ms / 1_000 end
def time_partitioning_field
-
(String, nil)- The time partition field, if a field was configured.
def time_partitioning_field @gapi.configuration.load.time_partitioning.field if time_partitioning? end
def time_partitioning_require_filter?
-
(Boolean)- `true` when a time partition filter will be required,
def time_partitioning_require_filter? tp = @gapi.configuration.load.time_partitioning return false if tp.nil? || tp.require_partition_filter.nil? tp.require_partition_filter end
def time_partitioning_type
-
(String, nil)- The time partition type. The supported types are `DAY`,
def time_partitioning_type @gapi.configuration.load.time_partitioning.type if time_partitioning? end
def time_zone
-
(String, nil)- The IANA time zone name, such as
def time_zone @gapi.configuration.load.time_zone end
def timestamp_format
-
(String, nil)- The timestamp format pattern, such as
def timestamp_format @gapi.configuration.load.timestamp_format end
def utf8?
-
(Boolean)- `true` when the character encoding is UTF-8,
def utf8? val = @gapi.configuration.load.encoding return true if val.nil? val == "UTF-8" end