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 one or more 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
-
#boolean(name, description: nil, mode: :nullable) ⇒ Object
Adds a boolean field to the schema.
-
#bytes(name, description: nil, mode: :nullable) ⇒ Object
Adds a bytes field to the schema.
- #copy ⇒ Object
- #copy_job ⇒ Object
- #data ⇒ Object
-
#date(name, description: nil, mode: :nullable) ⇒ Object
Adds a date field to the schema.
-
#datetime(name, description: nil, mode: :nullable) ⇒ Object
Adds a datetime field to the schema.
- #delete ⇒ Object
- #external ⇒ Object
- #extract ⇒ Object
- #extract_job ⇒ Object
-
#float(name, description: nil, mode: :nullable) ⇒ Object
Adds a floating-point number field to the schema.
- #insert ⇒ Object
- #insert_async ⇒ Object
-
#integer(name, description: nil, mode: :nullable) ⇒ Object
Adds an integer field to the schema.
- #load ⇒ Object
- #load_job ⇒ Object
-
#numeric(name, description: nil, mode: :nullable) ⇒ Object
Adds a numeric number field to the schema.
- #query ⇒ Object
- #query_job ⇒ Object
-
#record(name, description: nil, mode: 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) ⇒ Object
Adds a string field to the schema.
-
#time(name, description: nil, mode: :nullable) ⇒ Object
Adds a time field to the schema.
-
#timestamp(name, description: nil, mode: :nullable) ⇒ 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, #clustering?, #clustering_fields, #created_at, #dataset_id, #description, #description=, #encryption, #encryption=, #etag, #exists?, #expires_at, #external=, #external?, #fields, #headers, #id, #labels, #labels=, #location, #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?, #require_partition_filter, #require_partition_filter=, #resource?, #resource_full?, #resource_partial?, #rows_count, #set_query, #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=, #update_policy, #view?
Instance Method Details
#boolean(name, description: nil, mode: :nullable) ⇒ Object
Adds a boolean field to the schema.
See Schema#boolean.
3171 3172 3173 |
# File 'lib/google/cloud/bigquery/table.rb', line 3171 def boolean name, description: nil, mode: :nullable schema.boolean name, description: description, mode: mode end |
#bytes(name, description: nil, mode: :nullable) ⇒ Object
Adds a bytes field to the schema.
See Schema#bytes.
3199 3200 3201 |
# File 'lib/google/cloud/bigquery/table.rb', line 3199 def bytes name, description: nil, mode: :nullable schema.bytes name, description: description, mode: mode end |
#clustering_fields=(fields) ⇒ Object
Sets one or more fields on which data should be clustered. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently 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.
You can only set the clustering fields while creating a table as in the example below. BigQuery does not allow you to change clustering on an existing table.
2962 2963 2964 2965 2966 |
# File 'lib/google/cloud/bigquery/table.rb', line 2962 def clustering_fields= fields @gapi.clustering ||= Google::Apis::BigqueryV2::Clustering.new @gapi.clustering.fields = fields patch_gapi! :clustering end |
#copy ⇒ Object
3370 3371 3372 |
# File 'lib/google/cloud/bigquery/table.rb', line 3370 def copy(*) raise "not implemented in #{self.class}" end |
#copy_job ⇒ Object
3364 3365 3366 |
# File 'lib/google/cloud/bigquery/table.rb', line 3364 def copy_job(*) raise "not implemented in #{self.class}" end |
#data ⇒ Object
3358 3359 3360 |
# File 'lib/google/cloud/bigquery/table.rb', line 3358 def data(*) raise "not implemented in #{self.class}" end |
#date(name, description: nil, mode: :nullable) ⇒ Object
Adds a date field to the schema.
See Schema#date.
3311 3312 3313 |
# File 'lib/google/cloud/bigquery/table.rb', line 3311 def date name, description: nil, mode: :nullable schema.date name, description: description, mode: mode end |
#datetime(name, description: nil, mode: :nullable) ⇒ Object
Adds a datetime field to the schema.
See Schema#datetime.
3283 3284 3285 |
# File 'lib/google/cloud/bigquery/table.rb', line 3283 def datetime name, description: nil, mode: :nullable schema.datetime name, description: description, mode: mode end |
#delete ⇒ Object
3412 3413 3414 |
# File 'lib/google/cloud/bigquery/table.rb', line 3412 def delete raise "not implemented in #{self.class}" end |
#external ⇒ Object
3430 3431 3432 |
# File 'lib/google/cloud/bigquery/table.rb', line 3430 def external(*) raise "not implemented in #{self.class}" end |
#extract ⇒ Object
3382 3383 3384 |
# File 'lib/google/cloud/bigquery/table.rb', line 3382 def extract(*) raise "not implemented in #{self.class}" end |
#extract_job ⇒ Object
3376 3377 3378 |
# File 'lib/google/cloud/bigquery/table.rb', line 3376 def extract_job(*) raise "not implemented in #{self.class}" end |
#float(name, description: nil, mode: :nullable) ⇒ Object
Adds a floating-point number field to the schema.
See Schema#float.
3113 3114 3115 |
# File 'lib/google/cloud/bigquery/table.rb', line 3113 def float name, description: nil, mode: :nullable schema.float name, description: description, mode: mode end |
#insert ⇒ Object
3400 3401 3402 |
# File 'lib/google/cloud/bigquery/table.rb', line 3400 def insert(*) raise "not implemented in #{self.class}" end |
#insert_async ⇒ Object
3406 3407 3408 |
# File 'lib/google/cloud/bigquery/table.rb', line 3406 def insert_async(*) raise "not implemented in #{self.class}" end |
#integer(name, description: nil, mode: :nullable) ⇒ Object
Adds an integer field to the schema.
See Schema#integer.
3085 3086 3087 |
# File 'lib/google/cloud/bigquery/table.rb', line 3085 def integer name, description: nil, mode: :nullable schema.integer name, description: description, mode: mode end |
#load ⇒ Object
3394 3395 3396 |
# File 'lib/google/cloud/bigquery/table.rb', line 3394 def load(*) raise "not implemented in #{self.class}" end |
#load_job ⇒ Object
3388 3389 3390 |
# File 'lib/google/cloud/bigquery/table.rb', line 3388 def load_job(*) raise "not implemented in #{self.class}" end |
#numeric(name, description: nil, mode: :nullable) ⇒ Object
Adds a numeric number field to the schema. Numeric is a fixed-precision numeric type with 38 decimal digits, 9 that follow the decimal point.
See Schema#numeric
3143 3144 3145 |
# File 'lib/google/cloud/bigquery/table.rb', line 3143 def numeric name, description: nil, mode: :nullable schema.numeric name, description: description, mode: mode end |
#query ⇒ Object
3424 3425 3426 |
# File 'lib/google/cloud/bigquery/table.rb', line 3424 def query(*) raise "not implemented in #{self.class}" end |
#query_job ⇒ Object
3418 3419 3420 |
# File 'lib/google/cloud/bigquery/table.rb', line 3418 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=.
2909 2910 2911 2912 2913 2914 2915 2916 |
# File 'lib/google/cloud/bigquery/table.rb', line 2909 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.
2789 2790 2791 2792 2793 2794 2795 2796 |
# File 'lib/google/cloud/bigquery/table.rb', line 2789 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=.
2869 2870 2871 2872 2873 2874 2875 2876 |
# File 'lib/google/cloud/bigquery/table.rb', line 2869 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=.
2829 2830 2831 2832 2833 2834 2835 2836 |
# File 'lib/google/cloud/bigquery/table.rb', line 2829 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) {|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.
3350 3351 3352 |
# File 'lib/google/cloud/bigquery/table.rb', line 3350 def record name, description: nil, mode: nil, &block schema.record name, description: description, mode: mode, &block end |
#reload! ⇒ Object Also known as: refresh!
3436 3437 3438 |
# File 'lib/google/cloud/bigquery/table.rb', line 3436 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.
3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 |
# File 'lib/google/cloud/bigquery/table.rb', line 3020 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) ⇒ Object
Adds a string field to the schema.
See Schema#string.
3057 3058 3059 |
# File 'lib/google/cloud/bigquery/table.rb', line 3057 def string name, description: nil, mode: :nullable schema.string name, description: description, mode: mode end |
#time(name, description: nil, mode: :nullable) ⇒ Object
Adds a time field to the schema.
See Schema#time.
3255 3256 3257 |
# File 'lib/google/cloud/bigquery/table.rb', line 3255 def time name, description: nil, mode: :nullable schema.time name, description: description, mode: mode end |
#timestamp(name, description: nil, mode: :nullable) ⇒ Object
Adds a timestamp field to the schema.
See Schema#timestamp.
3227 3228 3229 |
# File 'lib/google/cloud/bigquery/table.rb', line 3227 def name, description: nil, mode: :nullable schema. name, description: description, mode: mode end |