Class: Google::Cloud::Bigquery::LoadJob::Updater
- Inherits:
-
Google::Cloud::Bigquery::LoadJob
- Object
- Job
- Google::Cloud::Bigquery::LoadJob
- Google::Cloud::Bigquery::LoadJob::Updater
- Defined in:
- lib/google/cloud/bigquery/load_job.rb
Overview
Yielded to a block to accumulate changes for a patch request.
Attributes collapse
-
#updates ⇒ Object
readonly
A list of attributes that were updated.
Attributes collapse
-
#autodetect=(val) ⇒ Object
Allows BigQuery to autodetect the schema.
- #cancel ⇒ Object
-
#clustering_fields=(fields) ⇒ Object
Sets the list of fields on which data should be clustered.
-
#column_name_character_map=(new_character_map) ⇒ Object
Sets the character map for column name conversion.
-
#create=(new_create) ⇒ Object
Sets the create disposition.
-
#create_session=(value) ⇒ Object
Sets the create_session property.
-
#date_format=(date_format) ⇒ Object
Sets the format used to parse DATE values.
-
#datetime_format=(datetime_format) ⇒ Object
Sets the format used to parse DATETIME values.
-
#delimiter=(val) ⇒ Object
Sets the separator for fields in a CSV file.
-
#encoding=(val) ⇒ Object
Sets the character encoding of the data.
-
#encryption=(val) ⇒ Object
Sets the encryption configuration of the destination table.
-
#format=(new_format) ⇒ Object
Sets the source file format.
-
#hive_partitioning_mode=(mode) ⇒ Object
Sets the mode of hive partitioning to use when reading data.
-
#hive_partitioning_source_uri_prefix=(source_uri_prefix) ⇒ Object
Sets the common prefix for all source uris when hive partition detection is requested.
-
#ignore_unknown=(val) ⇒ Object
Allows unknown columns to be ignored.
-
#jagged_rows=(val) ⇒ Object
Sets flag for allowing jagged rows.
-
#labels=(val) ⇒ Object
Sets the labels to use for the load job.
-
#location=(value) ⇒ Object
Sets the geographic location where the job should run.
-
#max_bad_records=(val) ⇒ Object
Sets the maximum number of bad records that can be ignored.
-
#null_marker=(val) ⇒ Object
Sets the string that represents a null value in a CSV file.
-
#null_markers=(null_markers) ⇒ Object
Sets the list of strings represented as SQL NULL value in a CSV file.
-
#parquet_enable_list_inference=(enable_list_inference) ⇒ Object
Sets whether to use schema inference specifically for Parquet
LISTlogical type. -
#parquet_enum_as_string=(enum_as_string) ⇒ Object
Sets whether to infer Parquet
ENUMlogical type asSTRINGinstead ofBYTESby default. -
#preserve_ascii_control_characters=(val) ⇒ Object
When source_format is set to
CSV, sets whether the embedded ASCII control characters (the first 32 characters in the ASCII-table, from\x00to\x1F) are preserved. -
#projection_fields=(new_fields) ⇒ Object
Sets the projection fields.
-
#quote=(val) ⇒ Object
Sets the character to use to quote string values in CSVs.
-
#quoted_newlines=(val) ⇒ Object
Allows quoted data sections to contain newline characters in CSV.
-
#range_partitioning_end=(range_end) ⇒ Object
Sets the end of range partitioning, exclusive, for the destination table.
-
#range_partitioning_field=(field) ⇒ Object
Sets the field on which to range partition the table.
-
#range_partitioning_interval=(range_interval) ⇒ Object
Sets width of each interval for data in range partitions.
-
#range_partitioning_start=(range_start) ⇒ Object
Sets the start of range partitioning, inclusive, for the destination table.
-
#reference_file_schema_uri=(uri) ⇒ Object
Sets the URI of the reference file with the reader schema.
- #reload! ⇒ Object (also: #refresh!)
- #rerun! ⇒ Object
-
#reservation=(value) ⇒ Object
Sets the reservation that job would use.
-
#schema_update_options=(new_options) ⇒ Object
Sets the schema update options, which allow the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration.
-
#session_id=(value) ⇒ Object
Sets the session ID for a query run in session mode.
-
#skip_leading=(val) ⇒ Object
Sets the number of leading rows to skip in the file.
-
#source_column_match=(source_column_match) ⇒ Object
Sets the strategy used to match loaded columns to the schema.
-
#source_uris=(new_uris) ⇒ Object
Sets the source URIs to load.
-
#time_format=(time_format) ⇒ Object
Sets the format used to parse TIME values.
-
#time_partitioning_expiration=(expiration) ⇒ Object
Sets the time partition expiration for the destination table.
-
#time_partitioning_field=(field) ⇒ Object
Sets the field on which to time partition the destination table.
-
#time_partitioning_require_filter=(val) ⇒ Object
If set to true, queries over the destination table will require a time partition filter that can be used for time partition elimination to be specified.
-
#time_partitioning_type=(type) ⇒ Object
Sets the time partitioning for the destination table.
-
#time_zone=(time_zone) ⇒ Object
Sets the time zone used when parsing timestamp values that do not have specific time zone information (e.g.
2024-04-20 12:34:56). -
#timestamp_format=(timestamp_format) ⇒ Object
Sets the format used to parse TIMESTAMP values.
- #wait_until_done! ⇒ Object
-
#write=(new_write) ⇒ Object
Sets the write disposition.
Schema collapse
-
#bignumeric(name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil) ⇒ Object
Adds a bignumeric number field to the schema.
-
#boolean(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a boolean field to the schema.
-
#bytes(name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil) ⇒ Object
Adds a bytes field to the schema.
-
#check_for_mutated_schema! ⇒ Object
Make sure any access changes are saved.
-
#date(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a date field to the schema.
-
#datetime(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a datetime field to the schema.
-
#float(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a floating-point number field to the schema.
-
#geography(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a geography field to the schema.
-
#integer(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds an integer field to the schema.
-
#json(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds an json field to the schema.
-
#numeric(name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil) ⇒ Object
Adds a numeric number field to the schema.
-
#record(name, description: nil, mode: nil, default_value_expression: nil) {|nested_schema| ... } ⇒ Object
Adds a record field to the schema.
-
#schema(replace: false) {|schema| ... } ⇒ Google::Cloud::Bigquery::Schema
Returns the table's schema.
-
#schema=(new_schema) ⇒ Object
Sets the schema of the destination table.
-
#string(name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil) ⇒ Object
Adds a string field to the schema.
-
#time(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a time field to the schema.
-
#timestamp(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a timestamp field to the schema.
Methods inherited from Google::Cloud::Bigquery::LoadJob
#allow_jagged_rows?, #autodetect?, #backup?, #clustering?, #clustering_fields, #csv?, #date_format, #datetime_format, #delimiter, #destination, #encryption, #hive_partitioning?, #hive_partitioning_mode, #hive_partitioning_source_uri_prefix, #ignore_unknown_values?, #input_file_bytes, #input_files, #iso8859_1?, #json?, #max_bad_records, #null_marker, #null_markers, #orc?, #output_bytes, #output_rows, #parquet?, #parquet_enable_list_inference?, #parquet_enum_as_string?, #parquet_options?, #preserve_ascii_control_characters, #quote, #quoted_newlines?, #range_partitioning?, #range_partitioning_end, #range_partitioning_field, #range_partitioning_interval, #range_partitioning_start, #reference_file_schema_uri, #schema_update_options, #skip_leading_rows, #source_column_match, #sources, #time_format, #time_partitioning?, #time_partitioning_expiration, #time_partitioning_field, #time_partitioning_require_filter?, #time_partitioning_type, #time_zone, #timestamp_format, #utf8?
Methods inherited from Job
#configuration, #created_at, #delete, #done?, #ended_at, #error, #errors, #failed?, #job_id, #labels, #location, #num_child_jobs, #parent_job_id, #pending?, #project_id, #reservation_usage, #running?, #script_statistics, #session_id, #started_at, #state, #statistics, #status, #transaction_id, #user_email
Instance Attribute Details
#updates ⇒ Object (readonly)
A list of attributes that were updated.
765 766 767 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 765 def updates @updates end |
Instance Method Details
#autodetect=(val) ⇒ Object
Allows BigQuery to autodetect the schema.
2014 2015 2016 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2014 def autodetect= val @gapi.configuration.load.update! autodetect: val end |
#bignumeric(name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil) ⇒ Object
Adds a bignumeric number field to the schema. BIGNUMERIC is a
decimal type with fixed precision and scale. Precision is the
number of digits that the number contains. Scale is how many of
these digits appear after the decimal point. It supports:
Precision: 76.76 (the 77th digit is partial) Scale: 38 Min: -5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+38 Max: 5.7896044618658097711785492504343953926634992332820282019728792003956564819967E+38
This type can represent decimal fractions exactly, and is suitable for financial calculations.
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1190 def bignumeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil schema.bignumeric name, description: description, mode: mode, policy_tags: , precision: precision, scale: scale, default_value_expression: default_value_expression end |
#boolean(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a boolean field to the schema.
See Schema#boolean.
1254 1255 1256 1257 1258 1259 1260 1261 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1254 def boolean name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.boolean name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#bytes(name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil) ⇒ Object
Adds a bytes field to the schema.
See Schema#bytes.
1318 1319 1320 1321 1322 1323 1324 1325 1326 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1318 def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil schema.bytes name, description: description, mode: mode, policy_tags: , max_length: max_length, default_value_expression: default_value_expression end |
#cancel ⇒ Object
2815 2816 2817 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2815 def cancel raise "not implemented in #{self.class}" end |
#check_for_mutated_schema! ⇒ Object
Make sure any access changes are saved
1775 1776 1777 1778 1779 1780 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1775 def check_for_mutated_schema! return if @schema.nil? return unless @schema.changed? @gapi.configuration.load.schema = @schema.to_gapi patch_gapi! :schema end |
#clustering_fields=(fields) ⇒ Object
Sets the list of fields on which data should be clustered.
Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
BigQuery supports clustering for both partitioned and non-partitioned tables.
See Google::Cloud::Bigquery::LoadJob#clustering_fields, Table#clustering_fields and Table#clustering_fields=.
2688 2689 2690 2691 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2688 def clustering_fields= fields @gapi.configuration.load.clustering ||= Google::Apis::BigqueryV2::Clustering.new @gapi.configuration.load.clustering.fields = fields end |
#column_name_character_map=(new_character_map) ⇒ Object
Sets the character map for column name conversion. The default value is default.
The following values are supported:
defaultstrictv1v2
1849 1850 1851 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1849 def column_name_character_map= new_character_map @gapi.configuration.load.update! column_name_character_map: Convert.character_map(new_character_map) end |
#create=(new_create) ⇒ Object
Sets the create disposition.
This specifies whether the job is allowed to create new tables. The
default value is needed.
The following values are supported:
needed- Create the table if it does not exist.never- The table must already exist. A 'notFound' error is raised if the table does not exist.
1869 1870 1871 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1869 def create= new_create @gapi.configuration.load.update! create_disposition: Convert.create_disposition(new_create) end |
#create_session=(value) ⇒ Object
Sets the create_session property. If true, creates a new session,
where session id will be a server generated random id. If false,
runs query with an existing #session_id=, otherwise runs query in
non-session mode. The default value is false.
value is false.
1904 1905 1906 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1904 def create_session= value @gapi.configuration.load.create_session = value end |
#date(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a date field to the schema.
See Schema#date.
1564 1565 1566 1567 1568 1569 1570 1571 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1564 def date name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.date name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#date_format=(date_format) ⇒ Object
Sets the format used to parse DATE values. Supports SQL-style values. See date and time formatting guide
2700 2701 2702 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2700 def date_format= date_format @gapi.configuration.load.update! date_format: date_format end |
#datetime(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a datetime field to the schema.
See Schema#datetime.
1502 1503 1504 1505 1506 1507 1508 1509 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1502 def datetime name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.datetime name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#datetime_format=(datetime_format) ⇒ Object
Sets the format used to parse DATETIME values. Supports SQL-style values. See date and time formatting guide
2711 2712 2713 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2711 def datetime_format= datetime_format @gapi.configuration.load.update! datetime_format: datetime_format end |
#delimiter=(val) ⇒ Object
Sets the separator for fields in a CSV file.
2041 2042 2043 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2041 def delimiter= val @gapi.configuration.load.update! field_delimiter: val end |
#encoding=(val) ⇒ Object
Sets the character encoding of the data.
2027 2028 2029 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2027 def encoding= val @gapi.configuration.load.update! encoding: val end |
#encryption=(val) ⇒ Object
Sets the encryption configuration of the destination table.
2179 2180 2181 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2179 def encryption= val @gapi.configuration.load.update! destination_encryption_configuration: val.to_gapi end |
#float(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a floating-point number field to the schema.
See Schema#float.
1025 1026 1027 1028 1029 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1025 def float name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.float name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#format=(new_format) ⇒ Object
Sets the source file format. The default value is csv.
The following values are supported:
csv- CSVjson- Newline-delimited JSONavro- Avroorc- ORCparquet- Parquetdatastore_backup- Cloud Datastore backup
1831 1832 1833 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1831 def format= new_format @gapi.configuration.load.update! source_format: Convert.source_format(new_format) end |
#geography(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a geography field to the schema.
See Schema#geography.
1630 1631 1632 1633 1634 1635 1636 1637 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1630 def geography name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.geography name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#hive_partitioning_mode=(mode) ⇒ Object
Sets the mode of hive partitioning to use when reading data. The following modes are supported:
auto: automatically infer partition key name(s) and type(s).strings: automatically infer partition key name(s). All types are interpreted as strings.custom: partition key schema is encoded in the source URI prefix.
Not all storage formats support hive partitioning. Requesting hive partitioning on an unsupported format
will lead to an error. Currently supported types include: avro, csv, json, orc and parquet.
2244 2245 2246 2247 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2244 def hive_partitioning_mode= mode @gapi.configuration.load. ||= Google::Apis::BigqueryV2::HivePartitioningOptions.new @gapi.configuration.load..mode = mode.to_s.upcase end |
#hive_partitioning_source_uri_prefix=(source_uri_prefix) ⇒ Object
Sets the common prefix for all source uris when hive partition detection is requested. The prefix must end immediately before the partition key encoding begins. For example, consider files following this data layout:
gs://bucket/path_to_table/dt=2019-01-01/country=BR/id=7/file.avro
gs://bucket/path_to_table/dt=2018-12-31/country=CA/id=3/file.avro
When hive partitioning is requested with either AUTO or STRINGS mode, the common prefix can be either of
gs://bucket/path_to_table or gs://bucket/path_to_table/ (trailing slash does not matter).
2287 2288 2289 2290 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2287 def hive_partitioning_source_uri_prefix= source_uri_prefix @gapi.configuration.load. ||= Google::Apis::BigqueryV2::HivePartitioningOptions.new @gapi.configuration.load..source_uri_prefix = source_uri_prefix end |
#ignore_unknown=(val) ⇒ Object
Allows unknown columns to be ignored.
2063 2064 2065 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2063 def ignore_unknown= val @gapi.configuration.load.update! ignore_unknown_values: val end |
#integer(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds an integer field to the schema.
See Schema#integer.
966 967 968 969 970 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 966 def integer name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.integer name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#jagged_rows=(val) ⇒ Object
Sets flag for allowing jagged rows.
Accept rows that are missing trailing optional columns. The missing
values are treated as nulls. If false, records with missing
trailing columns are treated as bad records, and if there are too
many bad records, an invalid error is returned in the job result.
The default value is false. Only applicable to CSV, ignored for
other formats.
1988 1989 1990 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1988 def jagged_rows= val @gapi.configuration.load.update! allow_jagged_rows: val end |
#json(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds an json field to the schema.
See Schema#json. https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#json_type
1698 1699 1700 1701 1702 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1698 def json name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.json name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#labels=(val) ⇒ Object
Sets the labels to use for the load job.
2205 2206 2207 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2205 def labels= val @gapi.configuration.update! labels: val end |
#location=(value) ⇒ Object
Sets the geographic location where the job should run. Required except for US and EU.
1806 1807 1808 1809 1810 1811 1812 1813 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1806 def location= value @gapi.job_reference.location = value return unless value.nil? # Treat assigning value of nil the same as unsetting the value. unset = @gapi.job_reference.instance_variables.include? :@location @gapi.job_reference.remove_instance_variable :@location if unset end |
#max_bad_records=(val) ⇒ Object
Sets the maximum number of bad records that can be ignored.
2078 2079 2080 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2078 def max_bad_records= val @gapi.configuration.load.update! max_bad_records: val end |
#null_marker=(val) ⇒ Object
Sets the string that represents a null value in a CSV file.
2096 2097 2098 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2096 def null_marker= val @gapi.configuration.load.update! null_marker: val end |
#null_markers=(null_markers) ⇒ Object
Sets the list of strings represented as SQL NULL value in a CSV file. null_marker and null_markers can't be set at the same time. If null_marker is set, null_markers has to be not set. If null_markers is set, null_marker has to be not set. If both null_marker and null_markers are set at the same time, a user error would be thrown. Any strings listed in null_markers, including empty string would be interpreted as SQL NULL. This applies to all column types.
2747 2748 2749 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2747 def null_markers= null_markers @gapi.configuration.load.update! null_markers: null_markers end |
#numeric(name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil) ⇒ Object
Adds a numeric number field to the schema. NUMERIC is a decimal
type with fixed precision and scale. Precision is the number of
digits that the number contains. Scale is how many of these
digits appear after the decimal point. It supports:
Precision: 38 Scale: 9 Min: -9.9999999999999999999999999999999999999E+28 Max: 9.9999999999999999999999999999999999999E+28
This type can represent decimal fractions exactly, and is suitable for financial calculations.
See Schema#numeric
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1105 def numeric name, description: nil, mode: :nullable, policy_tags: nil, precision: nil, scale: nil, default_value_expression: nil schema.numeric name, description: description, mode: mode, policy_tags: , precision: precision, scale: scale, default_value_expression: default_value_expression end |
#parquet_enable_list_inference=(enable_list_inference) ⇒ Object
Sets whether to use schema inference specifically for Parquet LIST logical type.
2317 2318 2319 2320 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2317 def parquet_enable_list_inference= enable_list_inference @gapi.configuration.load. ||= Google::Apis::BigqueryV2::ParquetOptions.new @gapi.configuration.load..enable_list_inference = enable_list_inference end |
#parquet_enum_as_string=(enum_as_string) ⇒ Object
Sets whether to infer Parquet ENUM logical type as STRING instead of BYTES by default.
2347 2348 2349 2350 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2347 def parquet_enum_as_string= enum_as_string @gapi.configuration.load. ||= Google::Apis::BigqueryV2::ParquetOptions.new @gapi.configuration.load..enum_as_string = enum_as_string end |
#preserve_ascii_control_characters=(val) ⇒ Object
When source_format is set to CSV, sets whether the embedded ASCII
control characters (the first 32 characters in the ASCII-table, from
\x00 to \x1F) are preserved. By default, ASCII control
characters are not preserved.
2799 2800 2801 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2799 def preserve_ascii_control_characters= val @gapi.configuration.load.update! preserve_ascii_control_characters: val end |
#projection_fields=(new_fields) ⇒ Object
Sets the projection fields.
If the format option is set to datastore_backup, indicates
which entity properties to load from a Cloud Datastore backup.
Property names are case sensitive and must be top-level properties.
If not set, BigQuery loads all properties. If any named property
isn't found in the Cloud Datastore backup, an invalid error is
returned.
1939 1940 1941 1942 1943 1944 1945 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1939 def projection_fields= new_fields if new_fields.nil? @gapi.configuration.load.update! projection_fields: nil else @gapi.configuration.load.update! projection_fields: Array(new_fields) end end |
#quote=(val) ⇒ Object
Sets the character to use to quote string values in CSVs.
2114 2115 2116 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2114 def quote= val @gapi.configuration.load.update! quote: val end |
#quoted_newlines=(val) ⇒ Object
Allows quoted data sections to contain newline characters in CSV.
2001 2002 2003 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2001 def quoted_newlines= val @gapi.configuration.load.update! allow_quoted_newlines: val end |
#range_partitioning_end=(range_end) ⇒ Object
Sets the end of range partitioning, exclusive, for the destination table. See Creating and using integer range partitioned tables.
You can only set range partitioning when creating a table. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_start=, #range_partitioning_interval= and #range_partitioning_field=.
2511 2512 2513 2514 2515 2516 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2511 def range_partitioning_end= range_end @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.configuration.load.range_partitioning.range.end = range_end end |
#range_partitioning_field=(field) ⇒ Object
Sets the field on which to range partition the table. See Creating and using integer range partitioned tables.
See #range_partitioning_start=, #range_partitioning_interval= and #range_partitioning_end=.
You can only set range partitioning when creating a table. BigQuery does not allow you to change partitioning on an existing table.
2388 2389 2390 2391 2392 2393 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2388 def range_partitioning_field= field @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.configuration.load.range_partitioning.field = field end |
#range_partitioning_interval=(range_interval) ⇒ Object
Sets width of each interval for data in range partitions. See Creating and using integer range partitioned tables.
You can only set range partitioning when creating a table. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_field=, #range_partitioning_start= and #range_partitioning_end=.
2470 2471 2472 2473 2474 2475 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2470 def range_partitioning_interval= range_interval @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.configuration.load.range_partitioning.range.interval = range_interval end |
#range_partitioning_start=(range_start) ⇒ Object
Sets the start of range partitioning, inclusive, for the destination table. See Creating and using integer range partitioned tables.
You can only set range partitioning when creating a table. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_field=, #range_partitioning_interval= and #range_partitioning_end=.
2429 2430 2431 2432 2433 2434 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2429 def range_partitioning_start= range_start @gapi.configuration.load.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.configuration.load.range_partitioning.range.start = range_start end |
#record(name, description: nil, mode: nil, default_value_expression: nil) {|nested_schema| ... } ⇒ Object
Adds a record field to the schema. A block must be passed describing the nested fields of the record. For more information about nested and repeated records, see Loading denormalized, nested, and repeated data .
See Schema#record.
1768 1769 1770 1771 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1768 def record name, description: nil, mode: nil, default_value_expression: nil, &block schema.record name, description: description, mode: mode, default_value_expression: default_value_expression, &block end |
#reference_file_schema_uri=(uri) ⇒ Object
Sets the URI of the reference file with the reader schema. This file
is only loaded if it is part of source URIs, but is not loaded
otherwise. It is enabled for the following formats: AVRO,
PARQUET, ORC.
2788 2789 2790 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2788 def reference_file_schema_uri= uri @gapi.configuration.load.update! reference_file_schema_uri: uri end |
#reload! ⇒ Object Also known as: refresh!
2823 2824 2825 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2823 def reload! raise "not implemented in #{self.class}" end |
#rerun! ⇒ Object
2819 2820 2821 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2819 def rerun! raise "not implemented in #{self.class}" end |
#reservation=(value) ⇒ Object
Sets the reservation that job would use. User can specify a reservation
to execute the job. If reservation is not set, reservation is determined
based on the rules defined by the reservation assignments. The expected
format is projects/project/locations/location/reservations/reservation``.
2811 2812 2813 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2811 def reservation= value @gapi.configuration.update! reservation: value end |
#schema(replace: false) {|schema| ... } ⇒ Google::Cloud::Bigquery::Schema
Returns the table's schema. This method can also be used to set, replace, or add to the schema by passing a block. See Schema for available methods.
808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 808 def schema replace: false # Same as Table#schema, but not frozen # TODO: make sure to call ensure_full_data! on Dataset#update @schema ||= Schema.from_gapi @gapi.configuration.load.schema if block_given? @schema = Schema.from_gapi if replace yield @schema check_for_mutated_schema! end # Do not freeze on updater, allow modifications @schema end |
#schema=(new_schema) ⇒ Object
Sets the schema of the destination table.
848 849 850 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 848 def schema= new_schema @schema = new_schema end |
#schema_update_options=(new_options) ⇒ Object
Sets the schema update options, which allow the schema of the
destination table to be updated as a side effect of the load job if
a schema is autodetected or supplied in the job configuration.
Schema update options are supported in two cases: when write
disposition is WRITE_APPEND; when write disposition is
WRITE_TRUNCATE and the destination table is a partition of a
table, specified by partition decorators. For normal tables,
WRITE_TRUNCATE will always overwrite the schema. One or more of
the following values are specified:
ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema.ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
2138 2139 2140 2141 2142 2143 2144 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2138 def if .nil? @gapi.configuration.load.update! schema_update_options: nil else @gapi.configuration.load.update! schema_update_options: Array() end end |
#session_id=(value) ⇒ Object
Sets the session ID for a query run in session mode. See #create_session=.
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1914 def session_id= value @gapi.configuration.load.connection_properties ||= [] prop = @gapi.configuration.load.connection_properties.find { |cp| cp.key == "session_id" } if prop prop.value = value else prop = Google::Apis::BigqueryV2::ConnectionProperty.new key: "session_id", value: value @gapi.configuration.load.connection_properties << prop end end |
#skip_leading=(val) ⇒ Object
Sets the number of leading rows to skip in the file.
2156 2157 2158 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2156 def skip_leading= val @gapi.configuration.load.update! skip_leading_rows: val end |
#source_column_match=(source_column_match) ⇒ Object
Sets the strategy used to match loaded columns to the schema. If not set, a sensible default is chosen based on how the schema is provided. If autodetect is used, then columns are matched by name. Otherwise, columns are matched by position. This is done to keep the behavior backward-compatible.
Acceptable values are:
POSITION: matches by position. Assumes columns are ordered the same way as the schema.NAME: matches by name. Reads the header row as column names and reorders columns to match the schema.
2765 2766 2767 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2765 def source_column_match= source_column_match @gapi.configuration.load.update! source_column_match: source_column_match end |
#source_uris=(new_uris) ⇒ Object
Sets the source URIs to load.
The fully-qualified URIs that point to your data in Google Cloud.
- For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For
- Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table.
- For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
1965 1966 1967 1968 1969 1970 1971 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1965 def source_uris= new_uris if new_uris.nil? @gapi.configuration.load.update! source_uris: nil else @gapi.configuration.load.update! source_uris: Array(new_uris) end end |
#string(name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil) ⇒ Object
Adds a string field to the schema.
See Schema#string.
907 908 909 910 911 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 907 def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil schema.string name, description: description, mode: mode, policy_tags: , max_length: max_length, default_value_expression: default_value_expression end |
#time(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a time field to the schema.
See Schema#time.
1440 1441 1442 1443 1444 1445 1446 1447 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1440 def time name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema.time name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#time_format=(time_format) ⇒ Object
Sets the format used to parse TIME values. Supports SQL-style values. See date and time formatting guide
2722 2723 2724 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2722 def time_format= time_format @gapi.configuration.load.update! time_format: time_format end |
#time_partitioning_expiration=(expiration) ⇒ Object
Sets the time partition expiration for the destination table. See Partitioned Tables.
The destination table must also be time partitioned. See #time_partitioning_type=.
2622 2623 2624 2625 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2622 def time_partitioning_expiration= expiration @gapi.configuration.load.time_partitioning ||= Google::Apis::BigqueryV2::TimePartitioning.new @gapi.configuration.load.time_partitioning.update! expiration_ms: expiration * 1000 end |
#time_partitioning_field=(field) ⇒ Object
Sets the field on which to time partition the destination table. If not
set, the destination table is time partitioned by pseudo column
_PARTITIONTIME; if set, the table is time partitioned by this field.
See Partitioned
Tables.
The destination table must also be time partitioned. See #time_partitioning_type=.
You can only set the time partitioning field while creating a table. BigQuery does not allow you to change partitioning on an existing table.
2589 2590 2591 2592 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2589 def time_partitioning_field= field @gapi.configuration.load.time_partitioning ||= Google::Apis::BigqueryV2::TimePartitioning.new @gapi.configuration.load.time_partitioning.update! field: field end |
#time_partitioning_require_filter=(val) ⇒ Object
If set to true, queries over the destination table will require a time partition filter that can be used for time partition elimination to be specified. See Partitioned Tables.
2638 2639 2640 2641 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2638 def time_partitioning_require_filter= val @gapi.configuration.load.time_partitioning ||= Google::Apis::BigqueryV2::TimePartitioning.new @gapi.configuration.load.time_partitioning.update! require_partition_filter: val end |
#time_partitioning_type=(type) ⇒ Object
Sets the time partitioning for the destination table. See Partitioned Tables.
You can only set the time partitioning field while creating a table. BigQuery does not allow you to change partitioning on an existing table.
2546 2547 2548 2549 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2546 def time_partitioning_type= type @gapi.configuration.load.time_partitioning ||= Google::Apis::BigqueryV2::TimePartitioning.new @gapi.configuration.load.time_partitioning.update! type: type end |
#time_zone=(time_zone) ⇒ Object
Sets the time zone used when parsing timestamp values that do not have
specific time zone information (e.g. 2024-04-20 12:34:56). The expected
format is an IANA timezone string (e.g. America/Los_Angeles).
2776 2777 2778 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2776 def time_zone= time_zone @gapi.configuration.load.update! time_zone: time_zone end |
#timestamp(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a timestamp field to the schema.
See Schema#timestamp.
1381 1382 1383 1384 1385 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1381 def name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil schema. name, description: description, mode: mode, policy_tags: , default_value_expression: default_value_expression end |
#timestamp_format=(timestamp_format) ⇒ Object
Sets the format used to parse TIMESTAMP values. Supports SQL-style values. See date and time formatting guide
2733 2734 2735 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2733 def @gapi.configuration.load.update! timestamp_format: end |
#wait_until_done! ⇒ Object
2828 2829 2830 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 2828 def wait_until_done! raise "not implemented in #{self.class}" end |
#write=(new_write) ⇒ Object
Sets the write disposition.
This specifies how to handle data already present in the table. The
default value is append.
The following values are supported:
truncate- BigQuery overwrites the table data.append- BigQuery appends the data to the table.empty- An error will be returned if the table already contains data.
1890 1891 1892 |
# File 'lib/google/cloud/bigquery/load_job.rb', line 1890 def write= new_write @gapi.configuration.load.update! write_disposition: Convert.write_disposition(new_write) end |