Class: Google::Cloud::Bigquery::Table::Updater
- Inherits:
-
Google::Cloud::Bigquery::Table
- Object
- Google::Cloud::Bigquery::Table
- Google::Cloud::Bigquery::Table::Updater
- Defined in:
- lib/google/cloud/bigquery/table.rb
Overview
Yielded to a block to accumulate changes for a create request. See Dataset#create_table.
Attributes collapse
-
#clustering_fields=(fields) ⇒ Object
Sets the list of fields on which data should be clustered.
-
#range_partitioning_end=(range_end) ⇒ Object
Sets the end of range partitioning, exclusive, for the 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 table.
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.
- #copy ⇒ Object
- #copy_job ⇒ Object
- #data ⇒ Object
-
#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.
- #delete ⇒ Object
- #external ⇒ Object
- #extract ⇒ Object
- #extract_job ⇒ Object
-
#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.
- #insert ⇒ Object
- #insert_async ⇒ Object
-
#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.
- #load ⇒ Object
- #load_job ⇒ Object
-
#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.
- #query ⇒ Object
- #query_job ⇒ Object
-
#record(name, description: nil, mode: nil, default_value_expression: nil) {|nested_schema| ... } ⇒ Object
Adds a record field to the schema.
- #reload! ⇒ Object (also: #refresh!)
-
#schema(replace: false) {|schema| ... } ⇒ Google::Cloud::Bigquery::Schema
Returns the table's schema.
-
#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::Table
#api_url, #buffer_bytes, #buffer_oldest_at, #buffer_rows, #bytes_count, #clone, #clone?, #clone_definition, #clustering?, #clustering_fields, #created_at, #dataset_id, #description, #description=, #enable_refresh=, #enable_refresh?, #encryption, #encryption=, #etag, #exists?, #expires_at, #external=, #external?, #fields, #headers, #id, #labels, #labels=, #last_refresh_time, #location, #materialized_view?, #modified_at, #name, #name=, #param_types, #policy, #project_id, #query=, #query_id, #query_legacy_sql?, #query_standard_sql?, #query_udfs, #range_partitioning?, #range_partitioning_end, #range_partitioning_field, #range_partitioning_interval, #range_partitioning_start, #reference?, #refresh_interval_ms, #refresh_interval_ms=, #require_partition_filter, #require_partition_filter=, #resource?, #resource_full?, #resource_partial?, #restore, #rows_count, #set_query, #snapshot, #snapshot?, #snapshot_definition, #table?, #table_id, #test_iam_permissions, #time_partitioning?, #time_partitioning_expiration, #time_partitioning_expiration=, #time_partitioning_field, #time_partitioning_field=, #time_partitioning_type, #time_partitioning_type=, #type, #update_policy, #view?
Instance Method Details
#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.
3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 |
# File 'lib/google/cloud/bigquery/table.rb', line 3863 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.
3927 3928 3929 3930 3931 |
# File 'lib/google/cloud/bigquery/table.rb', line 3927 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.
3988 3989 3990 3991 3992 |
# File 'lib/google/cloud/bigquery/table.rb', line 3988 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 |
#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::Table#clustering_fields and Google::Cloud::Bigquery::Table#clustering_fields=.
3454 3455 3456 3457 3458 |
# File 'lib/google/cloud/bigquery/table.rb', line 3454 def clustering_fields= fields @gapi.clustering ||= Google::Apis::BigqueryV2::Clustering.new @gapi.clustering.fields = fields patch_gapi! :clustering end |
#copy ⇒ Object
4430 4431 4432 |
# File 'lib/google/cloud/bigquery/table.rb', line 4430 def copy(*) raise "not implemented in #{self.class}" end |
#copy_job ⇒ Object
4424 4425 4426 |
# File 'lib/google/cloud/bigquery/table.rb', line 4424 def copy_job(*) raise "not implemented in #{self.class}" end |
#data ⇒ Object
4418 4419 4420 |
# File 'lib/google/cloud/bigquery/table.rb', line 4418 def data(*) raise "not implemented in #{self.class}" 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.
4224 4225 4226 4227 4228 |
# File 'lib/google/cloud/bigquery/table.rb', line 4224 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 |
#datetime(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a datetime field to the schema.
See Schema#datetime.
4165 4166 4167 4168 4169 |
# File 'lib/google/cloud/bigquery/table.rb', line 4165 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 |
#delete ⇒ Object
4472 4473 4474 |
# File 'lib/google/cloud/bigquery/table.rb', line 4472 def delete raise "not implemented in #{self.class}" end |
#external ⇒ Object
4490 4491 4492 |
# File 'lib/google/cloud/bigquery/table.rb', line 4490 def external(*) raise "not implemented in #{self.class}" end |
#extract ⇒ Object
4442 4443 4444 |
# File 'lib/google/cloud/bigquery/table.rb', line 4442 def extract(*) raise "not implemented in #{self.class}" end |
#extract_job ⇒ Object
4436 4437 4438 |
# File 'lib/google/cloud/bigquery/table.rb', line 4436 def extract_job(*) raise "not implemented in #{self.class}" 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.
3698 3699 3700 3701 3702 |
# File 'lib/google/cloud/bigquery/table.rb', line 3698 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 |
#geography(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a geography field to the schema.
4282 4283 4284 4285 4286 |
# File 'lib/google/cloud/bigquery/table.rb', line 4282 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 |
#insert ⇒ Object
4460 4461 4462 |
# File 'lib/google/cloud/bigquery/table.rb', line 4460 def insert(*) raise "not implemented in #{self.class}" end |
#insert_async ⇒ Object
4466 4467 4468 |
# File 'lib/google/cloud/bigquery/table.rb', line 4466 def insert_async(*) raise "not implemented in #{self.class}" 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.
3639 3640 3641 3642 3643 |
# File 'lib/google/cloud/bigquery/table.rb', line 3639 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 |
#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
4342 4343 4344 4345 4346 |
# File 'lib/google/cloud/bigquery/table.rb', line 4342 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 |
#load ⇒ Object
4454 4455 4456 |
# File 'lib/google/cloud/bigquery/table.rb', line 4454 def load(*) raise "not implemented in #{self.class}" end |
#load_job ⇒ Object
4448 4449 4450 |
# File 'lib/google/cloud/bigquery/table.rb', line 4448 def load_job(*) raise "not implemented in #{self.class}" 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
3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 |
# File 'lib/google/cloud/bigquery/table.rb', line 3778 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 |
#query ⇒ Object
4484 4485 4486 |
# File 'lib/google/cloud/bigquery/table.rb', line 4484 def query(*) raise "not implemented in #{self.class}" end |
#query_job ⇒ Object
4478 4479 4480 |
# File 'lib/google/cloud/bigquery/table.rb', line 4478 def query_job(*) raise "not implemented in #{self.class}" end |
#range_partitioning_end=(range_end) ⇒ Object
Sets the end of range partitioning, exclusive, for the table. See Creating and using integer range partitioned tables.
You can only set range partitioning when creating a table as in the example below. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_start=, #range_partitioning_interval= and #range_partitioning_field=.
3406 3407 3408 3409 3410 3411 3412 3413 |
# File 'lib/google/cloud/bigquery/table.rb', line 3406 def range_partitioning_end= range_end reload! unless resource_full? @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.range_partitioning.range.end = range_end patch_gapi! :range_partitioning 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 as in the example below. BigQuery does not allow you to change partitioning on an existing table.
3286 3287 3288 3289 3290 3291 3292 3293 |
# File 'lib/google/cloud/bigquery/table.rb', line 3286 def range_partitioning_field= field reload! unless resource_full? @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.range_partitioning.field = field patch_gapi! :range_partitioning 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 as in the example below. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_field=, #range_partitioning_start= and #range_partitioning_end=.
3366 3367 3368 3369 3370 3371 3372 3373 |
# File 'lib/google/cloud/bigquery/table.rb', line 3366 def range_partitioning_interval= range_interval reload! unless resource_full? @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.range_partitioning.range.interval = range_interval patch_gapi! :range_partitioning end |
#range_partitioning_start=(range_start) ⇒ Object
Sets the start of range partitioning, inclusive, for the table. See Creating and using integer range partitioned tables.
You can only set range partitioning when creating a table as in the example below. BigQuery does not allow you to change partitioning on an existing table.
See #range_partitioning_field=, #range_partitioning_interval= and #range_partitioning_end=.
3326 3327 3328 3329 3330 3331 3332 3333 |
# File 'lib/google/cloud/bigquery/table.rb', line 3326 def range_partitioning_start= range_start reload! unless resource_full? @gapi.range_partitioning ||= Google::Apis::BigqueryV2::RangePartitioning.new( range: Google::Apis::BigqueryV2::RangePartitioning::Range.new ) @gapi.range_partitioning.range.start = range_start patch_gapi! :range_partitioning 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.
4411 4412 4413 4414 |
# File 'lib/google/cloud/bigquery/table.rb', line 4411 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 |
#reload! ⇒ Object Also known as: refresh!
4496 4497 4498 |
# File 'lib/google/cloud/bigquery/table.rb', line 4496 def reload! raise "not implemented in #{self.class}" 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.
3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 |
# File 'lib/google/cloud/bigquery/table.rb', line 3512 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.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 |
#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.
3580 3581 3582 3583 3584 |
# File 'lib/google/cloud/bigquery/table.rb', line 3580 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.
4106 4107 4108 4109 4110 |
# File 'lib/google/cloud/bigquery/table.rb', line 4106 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 |
#timestamp(name, description: nil, mode: :nullable, policy_tags: nil, default_value_expression: nil) ⇒ Object
Adds a timestamp field to the schema.
See Schema#timestamp.
4047 4048 4049 4050 4051 |
# File 'lib/google/cloud/bigquery/table.rb', line 4047 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 |