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, #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, #time_partitioning?, #time_partitioning_expiration, #time_partitioning_expiration=, #time_partitioning_field, #time_partitioning_field=, #time_partitioning_type, #time_partitioning_type=, #view?
Instance Method Details
#boolean(name, description: nil, mode: :nullable) ⇒ Object
Adds a boolean field to the schema.
See Schema#boolean.
3069 3070 3071 |
# File 'lib/google/cloud/bigquery/table.rb', line 3069 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.
3097 3098 3099 |
# File 'lib/google/cloud/bigquery/table.rb', line 3097 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.
2860 2861 2862 2863 2864 |
# File 'lib/google/cloud/bigquery/table.rb', line 2860 def clustering_fields= fields @gapi.clustering ||= Google::Apis::BigqueryV2::Clustering.new @gapi.clustering.fields = fields patch_gapi! :clustering end |
#copy ⇒ Object
3268 3269 3270 |
# File 'lib/google/cloud/bigquery/table.rb', line 3268 def copy(*) raise "not implemented in #{self.class}" end |
#copy_job ⇒ Object
3262 3263 3264 |
# File 'lib/google/cloud/bigquery/table.rb', line 3262 def copy_job(*) raise "not implemented in #{self.class}" end |
#data ⇒ Object
3256 3257 3258 |
# File 'lib/google/cloud/bigquery/table.rb', line 3256 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.
3209 3210 3211 |
# File 'lib/google/cloud/bigquery/table.rb', line 3209 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.
3181 3182 3183 |
# File 'lib/google/cloud/bigquery/table.rb', line 3181 def datetime name, description: nil, mode: :nullable schema.datetime name, description: description, mode: mode end |
#delete ⇒ Object
3310 3311 3312 |
# File 'lib/google/cloud/bigquery/table.rb', line 3310 def delete raise "not implemented in #{self.class}" end |
#external ⇒ Object
3328 3329 3330 |
# File 'lib/google/cloud/bigquery/table.rb', line 3328 def external(*) raise "not implemented in #{self.class}" end |
#extract ⇒ Object
3280 3281 3282 |
# File 'lib/google/cloud/bigquery/table.rb', line 3280 def extract(*) raise "not implemented in #{self.class}" end |
#extract_job ⇒ Object
3274 3275 3276 |
# File 'lib/google/cloud/bigquery/table.rb', line 3274 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.
3011 3012 3013 |
# File 'lib/google/cloud/bigquery/table.rb', line 3011 def float name, description: nil, mode: :nullable schema.float name, description: description, mode: mode end |
#insert ⇒ Object
3298 3299 3300 |
# File 'lib/google/cloud/bigquery/table.rb', line 3298 def insert(*) raise "not implemented in #{self.class}" end |
#insert_async ⇒ Object
3304 3305 3306 |
# File 'lib/google/cloud/bigquery/table.rb', line 3304 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.
2983 2984 2985 |
# File 'lib/google/cloud/bigquery/table.rb', line 2983 def integer name, description: nil, mode: :nullable schema.integer name, description: description, mode: mode end |
#load ⇒ Object
3292 3293 3294 |
# File 'lib/google/cloud/bigquery/table.rb', line 3292 def load(*) raise "not implemented in #{self.class}" end |
#load_job ⇒ Object
3286 3287 3288 |
# File 'lib/google/cloud/bigquery/table.rb', line 3286 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
3041 3042 3043 |
# File 'lib/google/cloud/bigquery/table.rb', line 3041 def numeric name, description: nil, mode: :nullable schema.numeric name, description: description, mode: mode end |
#query ⇒ Object
3322 3323 3324 |
# File 'lib/google/cloud/bigquery/table.rb', line 3322 def query(*) raise "not implemented in #{self.class}" end |
#query_job ⇒ Object
3316 3317 3318 |
# File 'lib/google/cloud/bigquery/table.rb', line 3316 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=.
2807 2808 2809 2810 2811 2812 2813 2814 |
# File 'lib/google/cloud/bigquery/table.rb', line 2807 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.
2687 2688 2689 2690 2691 2692 2693 2694 |
# File 'lib/google/cloud/bigquery/table.rb', line 2687 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=.
2767 2768 2769 2770 2771 2772 2773 2774 |
# File 'lib/google/cloud/bigquery/table.rb', line 2767 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=.
2727 2728 2729 2730 2731 2732 2733 2734 |
# File 'lib/google/cloud/bigquery/table.rb', line 2727 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.
3248 3249 3250 |
# File 'lib/google/cloud/bigquery/table.rb', line 3248 def record name, description: nil, mode: nil, &block schema.record name, description: description, mode: mode, &block end |
#reload! ⇒ Object Also known as: refresh!
3334 3335 3336 |
# File 'lib/google/cloud/bigquery/table.rb', line 3334 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.
2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 |
# File 'lib/google/cloud/bigquery/table.rb', line 2918 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.
2955 2956 2957 |
# File 'lib/google/cloud/bigquery/table.rb', line 2955 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.
3153 3154 3155 |
# File 'lib/google/cloud/bigquery/table.rb', line 3153 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.
3125 3126 3127 |
# File 'lib/google/cloud/bigquery/table.rb', line 3125 def name, description: nil, mode: :nullable schema. name, description: description, mode: mode end |