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, collation: 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, #default_collation, #default_collation=, #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?, #resource_tags, #resource_tags=, #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.
4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 |
# File 'lib/google/cloud/bigquery/table.rb', line 4157 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.
4221 4222 4223 4224 4225 |
# File 'lib/google/cloud/bigquery/table.rb', line 4221 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.
4282 4283 4284 4285 4286 |
# File 'lib/google/cloud/bigquery/table.rb', line 4282 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=.
3743 3744 3745 3746 3747 |
# File 'lib/google/cloud/bigquery/table.rb', line 3743 def clustering_fields= fields @gapi.clustering ||= Google::Apis::BigqueryV2::Clustering.new @gapi.clustering.fields = fields patch_gapi! :clustering end |
#copy ⇒ Object
4724 4725 4726 |
# File 'lib/google/cloud/bigquery/table.rb', line 4724 def copy(*) raise "not implemented in #{self.class}" end |
#copy_job ⇒ Object
4718 4719 4720 |
# File 'lib/google/cloud/bigquery/table.rb', line 4718 def copy_job(*) raise "not implemented in #{self.class}" end |
#data ⇒ Object
4712 4713 4714 |
# File 'lib/google/cloud/bigquery/table.rb', line 4712 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.
4518 4519 4520 4521 4522 |
# File 'lib/google/cloud/bigquery/table.rb', line 4518 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.
4459 4460 4461 4462 4463 |
# File 'lib/google/cloud/bigquery/table.rb', line 4459 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
4766 4767 4768 |
# File 'lib/google/cloud/bigquery/table.rb', line 4766 def delete raise "not implemented in #{self.class}" end |
#external ⇒ Object
4784 4785 4786 |
# File 'lib/google/cloud/bigquery/table.rb', line 4784 def external(*) raise "not implemented in #{self.class}" end |
#extract ⇒ Object
4736 4737 4738 |
# File 'lib/google/cloud/bigquery/table.rb', line 4736 def extract(*) raise "not implemented in #{self.class}" end |
#extract_job ⇒ Object
4730 4731 4732 |
# File 'lib/google/cloud/bigquery/table.rb', line 4730 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.
3992 3993 3994 3995 3996 |
# File 'lib/google/cloud/bigquery/table.rb', line 3992 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.
4576 4577 4578 4579 4580 |
# File 'lib/google/cloud/bigquery/table.rb', line 4576 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
4754 4755 4756 |
# File 'lib/google/cloud/bigquery/table.rb', line 4754 def insert(*) raise "not implemented in #{self.class}" end |
#insert_async ⇒ Object
4760 4761 4762 |
# File 'lib/google/cloud/bigquery/table.rb', line 4760 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.
3933 3934 3935 3936 3937 |
# File 'lib/google/cloud/bigquery/table.rb', line 3933 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
4636 4637 4638 4639 4640 |
# File 'lib/google/cloud/bigquery/table.rb', line 4636 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
4748 4749 4750 |
# File 'lib/google/cloud/bigquery/table.rb', line 4748 def load(*) raise "not implemented in #{self.class}" end |
#load_job ⇒ Object
4742 4743 4744 |
# File 'lib/google/cloud/bigquery/table.rb', line 4742 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
4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 |
# File 'lib/google/cloud/bigquery/table.rb', line 4072 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
4778 4779 4780 |
# File 'lib/google/cloud/bigquery/table.rb', line 4778 def query(*) raise "not implemented in #{self.class}" end |
#query_job ⇒ Object
4772 4773 4774 |
# File 'lib/google/cloud/bigquery/table.rb', line 4772 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=.
3695 3696 3697 3698 3699 3700 3701 3702 |
# File 'lib/google/cloud/bigquery/table.rb', line 3695 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.
3575 3576 3577 3578 3579 3580 3581 3582 |
# File 'lib/google/cloud/bigquery/table.rb', line 3575 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=.
3655 3656 3657 3658 3659 3660 3661 3662 |
# File 'lib/google/cloud/bigquery/table.rb', line 3655 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=.
3615 3616 3617 3618 3619 3620 3621 3622 |
# File 'lib/google/cloud/bigquery/table.rb', line 3615 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.
4705 4706 4707 4708 |
# File 'lib/google/cloud/bigquery/table.rb', line 4705 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!
4790 4791 4792 |
# File 'lib/google/cloud/bigquery/table.rb', line 4790 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.
3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 |
# File 'lib/google/cloud/bigquery/table.rb', line 3801 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, collation: nil) ⇒ Object
Adds a string field to the schema.
See Schema#string.
3874 3875 3876 3877 3878 |
# File 'lib/google/cloud/bigquery/table.rb', line 3874 def string name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil, default_value_expression: nil, collation: nil schema.string name, description: description, mode: mode, policy_tags: , max_length: max_length, default_value_expression: default_value_expression, collation: collation 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.
4400 4401 4402 4403 4404 |
# File 'lib/google/cloud/bigquery/table.rb', line 4400 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.
4341 4342 4343 4344 4345 |
# File 'lib/google/cloud/bigquery/table.rb', line 4341 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 |