google-cloud-bigquery 1.27.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/google/cloud/bigquery/dataset.rb +97 -10
- data/lib/google/cloud/bigquery/project.rb +1 -2
- data/lib/google/cloud/bigquery/table.rb +146 -36
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44443c8c7fdf80fdfc611bba7ffcad2469ef60ff3aef8899f56a07fb4ced8555
|
4
|
+
data.tar.gz: 3b3f3020b6c4eebfa1a2a974f6d047068bd5d7f114b5d8c843c31401108b15b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb27c2d28ebb83a3f28a11241b7b260373dceade40159df44e31d6ab5de016079a00ddeba6943a09a6c7f8d303d08a24ca665160cd480b95f314382c2e45943
|
7
|
+
data.tar.gz: cf98a8d90c55cf065265c094a74ccf9f421a89e1c459b05189d4a7b33c8d97c9304c0e7256729de190a9bc7f74195fd6cff9170748cfb3bc4732a297f902b320
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.28.0 / 2021-03-09
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Add Materialized View support
|
8
|
+
* Add Dataset#create_materialized_view
|
9
|
+
* Add Table#materialized_view?
|
10
|
+
* Add Table#enable_refresh?
|
11
|
+
* Add Table#enable_refresh=
|
12
|
+
* Add Table#last_refresh_time
|
13
|
+
* Add Table#refresh_interval_ms
|
14
|
+
* Add Table#refresh_interval_ms=
|
15
|
+
|
3
16
|
### 1.27.0 / 2021-02-10
|
4
17
|
|
5
18
|
#### Features
|
@@ -618,15 +618,17 @@ module Google
|
|
618
618
|
end
|
619
619
|
|
620
620
|
##
|
621
|
-
# Creates a new
|
622
|
-
# table, which is a virtual table defined by the given SQL query.
|
621
|
+
# Creates a new view, which is a virtual table defined by the given SQL query.
|
623
622
|
#
|
624
|
-
# BigQuery's
|
625
|
-
#
|
626
|
-
# the view is queried. Queries are billed according to the total amount
|
623
|
+
# With BigQuery's logical views, the query that defines the view is re-executed
|
624
|
+
# every time the view is queried. Queries are billed according to the total amount
|
627
625
|
# of data in all table fields referenced directly or indirectly by the
|
628
626
|
# top-level query. (See {Table#view?} and {Table#query}.)
|
629
627
|
#
|
628
|
+
# For materialized views, see {#create_materialized_view}.
|
629
|
+
#
|
630
|
+
# @see https://cloud.google.com/bigquery/docs/views Creating views
|
631
|
+
#
|
630
632
|
# @param [String] table_id The ID of the view table. The ID must contain
|
631
633
|
# only letters (a-z, A-Z), numbers (0-9), or underscores (_). The
|
632
634
|
# maximum length is 1,024 characters.
|
@@ -667,7 +669,7 @@ module Google
|
|
667
669
|
# dataset = bigquery.dataset "my_dataset"
|
668
670
|
#
|
669
671
|
# view = dataset.create_view "my_view",
|
670
|
-
#
|
672
|
+
# "SELECT name, age FROM proj.dataset.users"
|
671
673
|
#
|
672
674
|
# @example A name and description can be provided:
|
673
675
|
# require "google/cloud/bigquery"
|
@@ -676,13 +678,18 @@ module Google
|
|
676
678
|
# dataset = bigquery.dataset "my_dataset"
|
677
679
|
#
|
678
680
|
# view = dataset.create_view "my_view",
|
679
|
-
#
|
680
|
-
#
|
681
|
+
# "SELECT name, age FROM proj.dataset.users",
|
682
|
+
# name: "My View", description: "This is my view"
|
681
683
|
#
|
682
684
|
# @!group Table
|
683
685
|
#
|
684
|
-
def create_view table_id,
|
685
|
-
|
686
|
+
def create_view table_id,
|
687
|
+
query,
|
688
|
+
name: nil,
|
689
|
+
description: nil,
|
690
|
+
standard_sql: nil,
|
691
|
+
legacy_sql: nil,
|
692
|
+
udfs: nil
|
686
693
|
use_legacy_sql = Convert.resolve_legacy_sql standard_sql, legacy_sql
|
687
694
|
new_view_opts = {
|
688
695
|
table_reference: Google::Apis::BigqueryV2::TableReference.new(
|
@@ -704,6 +711,80 @@ module Google
|
|
704
711
|
Table.from_gapi gapi, service
|
705
712
|
end
|
706
713
|
|
714
|
+
##
|
715
|
+
# Creates a new materialized view.
|
716
|
+
#
|
717
|
+
# Materialized views are precomputed views that periodically cache results of a query for increased performance
|
718
|
+
# and efficiency. BigQuery leverages precomputed results from materialized views and whenever possible reads
|
719
|
+
# only delta changes from the base table to compute up-to-date results.
|
720
|
+
#
|
721
|
+
# Queries that use materialized views are generally faster and consume less resources than queries that retrieve
|
722
|
+
# the same data only from the base table. Materialized views are helpful to significantly boost performance of
|
723
|
+
# workloads that have the characteristic of common and repeated queries.
|
724
|
+
#
|
725
|
+
# For logical views, see {#create_view}.
|
726
|
+
#
|
727
|
+
# @see https://cloud.google.com/bigquery/docs/materialized-views-intro Introduction to materialized views
|
728
|
+
#
|
729
|
+
# @param [String] table_id The ID of the materialized view table. The ID must contain only letters (a-z, A-Z),
|
730
|
+
# numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
|
731
|
+
# @param [String] query The query that BigQuery executes when the materialized view is referenced.
|
732
|
+
# @param [String] name A descriptive name for the table.
|
733
|
+
# @param [String] description A user-friendly description of the table.
|
734
|
+
# @param [Boolean] enable_refresh Enable automatic refresh of the materialized view when the base table is
|
735
|
+
# updated. Optional. The default value is true.
|
736
|
+
# @param [Integer] refresh_interval_ms The maximum frequency in milliseconds at which this materialized view
|
737
|
+
# will be refreshed. Optional. The default value is `1_800_000` (30 minutes).
|
738
|
+
#
|
739
|
+
# @return [Google::Cloud::Bigquery::Table] A new table object.
|
740
|
+
#
|
741
|
+
# @example
|
742
|
+
# require "google/cloud/bigquery"
|
743
|
+
#
|
744
|
+
# bigquery = Google::Cloud::Bigquery.new
|
745
|
+
# dataset = bigquery.dataset "my_dataset"
|
746
|
+
#
|
747
|
+
# materialized_view = dataset.create_materialized_view "my_materialized_view",
|
748
|
+
# "SELECT name, age FROM proj.dataset.users"
|
749
|
+
#
|
750
|
+
# @example Automatic refresh can be disabled:
|
751
|
+
# require "google/cloud/bigquery"
|
752
|
+
#
|
753
|
+
# bigquery = Google::Cloud::Bigquery.new
|
754
|
+
# dataset = bigquery.dataset "my_dataset"
|
755
|
+
#
|
756
|
+
# materialized_view = dataset.create_materialized_view "my_materialized_view",
|
757
|
+
# "SELECT name, age FROM proj.dataset.users",
|
758
|
+
# enable_refresh: false
|
759
|
+
#
|
760
|
+
# @!group Table
|
761
|
+
#
|
762
|
+
def create_materialized_view table_id,
|
763
|
+
query,
|
764
|
+
name: nil,
|
765
|
+
description: nil,
|
766
|
+
enable_refresh: nil,
|
767
|
+
refresh_interval_ms: nil
|
768
|
+
new_view_opts = {
|
769
|
+
table_reference: Google::Apis::BigqueryV2::TableReference.new(
|
770
|
+
project_id: project_id,
|
771
|
+
dataset_id: dataset_id,
|
772
|
+
table_id: table_id
|
773
|
+
),
|
774
|
+
friendly_name: name,
|
775
|
+
description: description,
|
776
|
+
materialized_view: Google::Apis::BigqueryV2::MaterializedViewDefinition.new(
|
777
|
+
enable_refresh: enable_refresh,
|
778
|
+
query: query,
|
779
|
+
refresh_interval_ms: refresh_interval_ms
|
780
|
+
)
|
781
|
+
}.delete_if { |_, v| v.nil? }
|
782
|
+
new_view = Google::Apis::BigqueryV2::Table.new new_view_opts
|
783
|
+
|
784
|
+
gapi = service.insert_table dataset_id, new_view
|
785
|
+
Table.from_gapi gapi, service
|
786
|
+
end
|
787
|
+
|
707
788
|
##
|
708
789
|
# Retrieves an existing table by ID.
|
709
790
|
#
|
@@ -2756,6 +2837,12 @@ module Google
|
|
2756
2837
|
raise "not implemented in #{self.class}"
|
2757
2838
|
end
|
2758
2839
|
|
2840
|
+
##
|
2841
|
+
# @raise [RuntimeError] not implemented
|
2842
|
+
def create_materialized_view(*)
|
2843
|
+
raise "not implemented in #{self.class}"
|
2844
|
+
end
|
2845
|
+
|
2759
2846
|
##
|
2760
2847
|
# @raise [RuntimeError] not implemented
|
2761
2848
|
def table(*)
|
@@ -981,8 +981,7 @@ module Google
|
|
981
981
|
# @param [String] description A user-friendly description of the
|
982
982
|
# dataset.
|
983
983
|
# @param [Integer] expiration The default lifetime of all tables in the
|
984
|
-
# dataset, in milliseconds. The minimum value is
|
985
|
-
# (one hour).
|
984
|
+
# dataset, in milliseconds. The minimum value is `3_600_000` (one hour).
|
986
985
|
# @param [String] location The geographic location where the dataset
|
987
986
|
# should reside. Possible values include `EU` and `US`. The default
|
988
987
|
# value is `US`.
|
@@ -37,16 +37,16 @@ module Google
|
|
37
37
|
# repeated fields.
|
38
38
|
#
|
39
39
|
# The Table class can also represent a
|
40
|
-
# [view](https://cloud.google.com/bigquery/docs/views), which is a virtual
|
41
|
-
# table defined by a SQL query
|
42
|
-
# materialized views,
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# indirectly by the top-level query. (See {#view?}, {#query}, {#query=},
|
46
|
-
# and {Dataset#create_view}.)
|
40
|
+
# [logical view](https://cloud.google.com/bigquery/docs/views), which is a virtual
|
41
|
+
# table defined by a SQL query (see {#view?} and {Dataset#create_view}); or a
|
42
|
+
# [materialized view](https://cloud.google.com/bigquery/docs/materialized-views-intro),
|
43
|
+
# which is a precomputed view that periodically caches results of a query for increased
|
44
|
+
# performance and efficiency (see {#materialized_view?} and {Dataset#create_materialized_view}).
|
47
45
|
#
|
48
46
|
# @see https://cloud.google.com/bigquery/docs/loading-data#loading_denormalized_nested_and_repeated_data
|
49
47
|
# Loading denormalized, nested, and repeated data
|
48
|
+
# @see https://cloud.google.com/bigquery/docs/views Creating views
|
49
|
+
# @see https://cloud.google.com/bigquery/docs/materialized-views-intro Introduction to materialized views
|
50
50
|
#
|
51
51
|
# @example
|
52
52
|
# require "google/cloud/bigquery"
|
@@ -77,7 +77,7 @@ module Google
|
|
77
77
|
# }
|
78
78
|
# table.insert row
|
79
79
|
#
|
80
|
-
# @example Creating a
|
80
|
+
# @example Creating a logical view:
|
81
81
|
# require "google/cloud/bigquery"
|
82
82
|
#
|
83
83
|
# bigquery = Google::Cloud::Bigquery.new
|
@@ -86,6 +86,15 @@ module Google
|
|
86
86
|
# "SELECT name, age FROM `my_project.my_dataset.my_table`"
|
87
87
|
# view.view? # true
|
88
88
|
#
|
89
|
+
# @example Creating a materialized view:
|
90
|
+
# require "google/cloud/bigquery"
|
91
|
+
#
|
92
|
+
# bigquery = Google::Cloud::Bigquery.new
|
93
|
+
# dataset = bigquery.dataset "my_dataset"
|
94
|
+
# view = dataset.create_materialized_view "my_materialized_view",
|
95
|
+
# "SELECT name, age FROM `my_project.my_dataset.my_table`"
|
96
|
+
# view.materialized_view? # true
|
97
|
+
#
|
89
98
|
class Table
|
90
99
|
##
|
91
100
|
# @private The Service object.
|
@@ -726,7 +735,7 @@ module Google
|
|
726
735
|
end
|
727
736
|
|
728
737
|
##
|
729
|
-
# Checks if the table's type is
|
738
|
+
# Checks if the table's type is `TABLE`.
|
730
739
|
#
|
731
740
|
# @return [Boolean, nil] `true` when the type is `TABLE`, `false`
|
732
741
|
# otherwise, if the object is a resource (see {#resource?}); `nil` if
|
@@ -740,8 +749,10 @@ module Google
|
|
740
749
|
end
|
741
750
|
|
742
751
|
##
|
743
|
-
# Checks if the table's type is
|
744
|
-
# represents a BigQuery view. See {Dataset#create_view}.
|
752
|
+
# Checks if the table's type is `VIEW`, indicating that the table
|
753
|
+
# represents a BigQuery logical view. See {Dataset#create_view}.
|
754
|
+
#
|
755
|
+
# @see https://cloud.google.com/bigquery/docs/views Creating views
|
745
756
|
#
|
746
757
|
# @return [Boolean, nil] `true` when the type is `VIEW`, `false`
|
747
758
|
# otherwise, if the object is a resource (see {#resource?}); `nil` if
|
@@ -755,7 +766,25 @@ module Google
|
|
755
766
|
end
|
756
767
|
|
757
768
|
##
|
758
|
-
# Checks if the table's type is
|
769
|
+
# Checks if the table's type is `MATERIALIZED_VIEW`, indicating that
|
770
|
+
# the table represents a BigQuery materialized view.
|
771
|
+
# See {Dataset#create_materialized_view}.
|
772
|
+
#
|
773
|
+
# @see https://cloud.google.com/bigquery/docs/materialized-views-intro Introduction to materialized views
|
774
|
+
#
|
775
|
+
# @return [Boolean, nil] `true` when the type is `MATERIALIZED_VIEW`,
|
776
|
+
# `false` otherwise, if the object is a resource (see {#resource?});
|
777
|
+
# `nil` if the object is a reference (see {#reference?}).
|
778
|
+
#
|
779
|
+
# @!group Attributes
|
780
|
+
#
|
781
|
+
def materialized_view?
|
782
|
+
return nil if reference?
|
783
|
+
@gapi.type == "MATERIALIZED_VIEW"
|
784
|
+
end
|
785
|
+
|
786
|
+
##
|
787
|
+
# Checks if the table's type is `EXTERNAL`, indicating that the table
|
759
788
|
# represents an External Data Source. See {#external?} and
|
760
789
|
# {External::DataSource}.
|
761
790
|
#
|
@@ -1138,21 +1167,24 @@ module Google
|
|
1138
1167
|
end
|
1139
1168
|
|
1140
1169
|
##
|
1141
|
-
# The query that
|
1170
|
+
# The query that defines the view or materialized view. See {#view?} and
|
1171
|
+
# {#materialized_view?}.
|
1142
1172
|
#
|
1143
|
-
# @return [String] The query that defines the view
|
1173
|
+
# @return [String, nil] The query that defines the view or materialized_view;
|
1174
|
+
# or `nil` if not a view or materialized view.
|
1144
1175
|
#
|
1145
1176
|
# @!group Attributes
|
1146
1177
|
#
|
1147
1178
|
def query
|
1148
|
-
@gapi.view&.query
|
1179
|
+
view? ? @gapi.view&.query : @gapi.materialized_view&.query
|
1149
1180
|
end
|
1150
1181
|
|
1151
1182
|
##
|
1152
|
-
# Updates the query that
|
1183
|
+
# Updates the query that defines the view. (See {#view?}.) Not supported
|
1184
|
+
# for materialized views.
|
1153
1185
|
#
|
1154
|
-
# This sets the query using standard SQL. To specify legacy SQL or
|
1155
|
-
# use user-defined function resources use (#set_query) instead.
|
1186
|
+
# This method sets the query using standard SQL. To specify legacy SQL or
|
1187
|
+
# to use user-defined function resources for a view, use (#set_query) instead.
|
1156
1188
|
#
|
1157
1189
|
# @see https://cloud.google.com/bigquery/query-reference BigQuery Query
|
1158
1190
|
# Reference
|
@@ -1167,7 +1199,7 @@ module Google
|
|
1167
1199
|
# view = dataset.table "my_view"
|
1168
1200
|
#
|
1169
1201
|
# view.query = "SELECT first_name FROM " \
|
1170
|
-
#
|
1202
|
+
# "`my_project.my_dataset.my_table`"
|
1171
1203
|
#
|
1172
1204
|
# @!group Lifecycle
|
1173
1205
|
#
|
@@ -1176,12 +1208,12 @@ module Google
|
|
1176
1208
|
end
|
1177
1209
|
|
1178
1210
|
##
|
1179
|
-
# Updates the query that
|
1180
|
-
#
|
1181
|
-
# resources.
|
1211
|
+
# Updates the query that defines the view. (See {#view?}.) Not supported for
|
1212
|
+
# materialized views.
|
1182
1213
|
#
|
1183
|
-
#
|
1184
|
-
#
|
1214
|
+
# Allows setting of standard vs. legacy SQL and user-defined function resources.
|
1215
|
+
#
|
1216
|
+
# @see https://cloud.google.com/bigquery/query-reference BigQuery Query Reference
|
1185
1217
|
#
|
1186
1218
|
# @param [String] query The query that defines the view.
|
1187
1219
|
# @param [Boolean] standard_sql Specifies whether to use BigQuery's
|
@@ -1193,11 +1225,12 @@ module Google
|
|
1193
1225
|
# SQL](https://cloud.google.com/bigquery/docs/reference/legacy-sql)
|
1194
1226
|
# dialect. Optional. The default value is false.
|
1195
1227
|
# @param [Array<String>, String] udfs User-defined function resources
|
1196
|
-
# used in a legacy SQL query.
|
1197
|
-
#
|
1198
|
-
#
|
1199
|
-
#
|
1200
|
-
#
|
1228
|
+
# used in a legacy SQL query. Optional.
|
1229
|
+
#
|
1230
|
+
# May be either a code resource to load from a Google Cloud Storage URI
|
1231
|
+
# (`gs://bucket/path`), or an inline resource that contains code for a
|
1232
|
+
# user-defined function (UDF). Providing an inline code resource is equivalent
|
1233
|
+
# to providing a URI for a file containing the same code.
|
1201
1234
|
#
|
1202
1235
|
# This parameter is used for defining User Defined Function (UDF)
|
1203
1236
|
# resources only when using legacy SQL. Users of standard SQL should
|
@@ -1208,7 +1241,7 @@ module Google
|
|
1208
1241
|
# standard SQL - Differences in user-defined JavaScript
|
1209
1242
|
# functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions)
|
1210
1243
|
#
|
1211
|
-
# @example
|
1244
|
+
# @example Update a view:
|
1212
1245
|
# require "google/cloud/bigquery"
|
1213
1246
|
#
|
1214
1247
|
# bigquery = Google::Cloud::Bigquery.new
|
@@ -1216,12 +1249,13 @@ module Google
|
|
1216
1249
|
# view = dataset.table "my_view"
|
1217
1250
|
#
|
1218
1251
|
# view.set_query "SELECT first_name FROM " \
|
1219
|
-
#
|
1252
|
+
# "`my_project.my_dataset.my_table`",
|
1220
1253
|
# standard_sql: true
|
1221
1254
|
#
|
1222
1255
|
# @!group Lifecycle
|
1223
1256
|
#
|
1224
1257
|
def set_query query, standard_sql: nil, legacy_sql: nil, udfs: nil
|
1258
|
+
raise "Updating the query is not supported for Table type: #{@gapi.type}" unless view?
|
1225
1259
|
use_legacy_sql = Convert.resolve_legacy_sql standard_sql, legacy_sql
|
1226
1260
|
@gapi.view = Google::Apis::BigqueryV2::ViewDefinition.new(
|
1227
1261
|
query: query,
|
@@ -1232,26 +1266,28 @@ module Google
|
|
1232
1266
|
end
|
1233
1267
|
|
1234
1268
|
##
|
1235
|
-
# Checks if the view's query is using legacy sql.
|
1269
|
+
# Checks if the view's query is using legacy sql. See {#view?}.
|
1236
1270
|
#
|
1237
|
-
# @return [Boolean] `true` when legacy sql is used, `false` otherwise.
|
1271
|
+
# @return [Boolean] `true` when legacy sql is used, `false` otherwise; or `nil` if not a logical view.
|
1238
1272
|
#
|
1239
1273
|
# @!group Attributes
|
1240
1274
|
#
|
1241
1275
|
def query_legacy_sql?
|
1276
|
+
return nil unless @gapi.view
|
1242
1277
|
val = @gapi.view.use_legacy_sql
|
1243
1278
|
return true if val.nil?
|
1244
1279
|
val
|
1245
1280
|
end
|
1246
1281
|
|
1247
1282
|
##
|
1248
|
-
# Checks if the view's query is using standard sql.
|
1283
|
+
# Checks if the view's query is using standard sql. See {#view?}.
|
1249
1284
|
#
|
1250
1285
|
# @return [Boolean] `true` when standard sql is used, `false` otherwise.
|
1251
1286
|
#
|
1252
1287
|
# @!group Attributes
|
1253
1288
|
#
|
1254
1289
|
def query_standard_sql?
|
1290
|
+
return nil unless @gapi.view
|
1255
1291
|
!query_legacy_sql?
|
1256
1292
|
end
|
1257
1293
|
|
@@ -1263,18 +1299,92 @@ module Google
|
|
1263
1299
|
# equivalent to providing a URI for a file containing the same code. See
|
1264
1300
|
# [User-Defined
|
1265
1301
|
# Functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions).
|
1302
|
+
# See {#view?}.
|
1266
1303
|
#
|
1267
|
-
# @return [Array<String
|
1268
|
-
# and/or inline source code.
|
1304
|
+
# @return [Array<String>, nil] An array containing Google Cloud Storage URIs
|
1305
|
+
# and/or inline source code, or `nil` if not a logical view.
|
1269
1306
|
#
|
1270
1307
|
# @!group Attributes
|
1271
1308
|
#
|
1272
1309
|
def query_udfs
|
1310
|
+
return nil unless @gapi.view
|
1273
1311
|
udfs_gapi = @gapi.view.user_defined_function_resources
|
1274
1312
|
return [] if udfs_gapi.nil?
|
1275
1313
|
Array(udfs_gapi).map { |udf| udf.inline_code || udf.resource_uri }
|
1276
1314
|
end
|
1277
1315
|
|
1316
|
+
##
|
1317
|
+
# Whether automatic refresh of the materialized view is enabled. When true,
|
1318
|
+
# the materialized view is updated when the base table is updated. The default
|
1319
|
+
# value is true. See {#materialized_view?}.
|
1320
|
+
#
|
1321
|
+
# @return [Boolean, nil] `true` when automatic refresh is enabled, `false` otherwise;
|
1322
|
+
# or `nil` if not a materialized view.
|
1323
|
+
#
|
1324
|
+
# @!group Attributes
|
1325
|
+
#
|
1326
|
+
def enable_refresh?
|
1327
|
+
return nil unless @gapi.materialized_view
|
1328
|
+
val = @gapi.materialized_view.enable_refresh
|
1329
|
+
return true if val.nil?
|
1330
|
+
val
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
##
|
1334
|
+
# Sets whether automatic refresh of the materialized view is enabled. When true,
|
1335
|
+
# the materialized view is updated when the base table is updated. See {#materialized_view?}.
|
1336
|
+
#
|
1337
|
+
# @param [Boolean] new_enable_refresh `true` when automatic refresh is enabled, `false` otherwise.
|
1338
|
+
#
|
1339
|
+
# @!group Attributes
|
1340
|
+
#
|
1341
|
+
def enable_refresh= new_enable_refresh
|
1342
|
+
@gapi.materialized_view = Google::Apis::BigqueryV2::MaterializedViewDefinition.new(
|
1343
|
+
enable_refresh: new_enable_refresh
|
1344
|
+
)
|
1345
|
+
patch_gapi! :materialized_view
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
##
|
1349
|
+
# The time when the materialized view was last modified.
|
1350
|
+
# See {#materialized_view?}.
|
1351
|
+
#
|
1352
|
+
# @return [Time, nil] The time, or `nil` if not present or not a materialized view.
|
1353
|
+
#
|
1354
|
+
# @!group Attributes
|
1355
|
+
#
|
1356
|
+
def last_refresh_time
|
1357
|
+
Convert.millis_to_time @gapi.materialized_view&.last_refresh_time
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
##
|
1361
|
+
# The maximum frequency in milliseconds at which the materialized view will be refreshed.
|
1362
|
+
# See {#materialized_view?}.
|
1363
|
+
#
|
1364
|
+
# @return [Integer, nil] The maximum frequency in milliseconds;
|
1365
|
+
# or `nil` if not a materialized view.
|
1366
|
+
#
|
1367
|
+
# @!group Attributes
|
1368
|
+
#
|
1369
|
+
def refresh_interval_ms
|
1370
|
+
@gapi.materialized_view&.refresh_interval_ms
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
##
|
1374
|
+
# Sets the maximum frequency at which the materialized view will be refreshed.
|
1375
|
+
# See {#materialized_view?}.
|
1376
|
+
#
|
1377
|
+
# @param [Integer] new_refresh_interval_ms The maximum frequency in milliseconds.
|
1378
|
+
#
|
1379
|
+
# @!group Attributes
|
1380
|
+
#
|
1381
|
+
def refresh_interval_ms= new_refresh_interval_ms
|
1382
|
+
@gapi.materialized_view = Google::Apis::BigqueryV2::MaterializedViewDefinition.new(
|
1383
|
+
refresh_interval_ms: new_refresh_interval_ms
|
1384
|
+
)
|
1385
|
+
patch_gapi! :materialized_view
|
1386
|
+
end
|
1387
|
+
|
1278
1388
|
##
|
1279
1389
|
# Gets the Cloud IAM access control policy for the table. The latest policy will be read from the service. See
|
1280
1390
|
# also {#update_policy}.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
293
|
requirements: []
|
294
|
-
rubygems_version: 3.2.
|
294
|
+
rubygems_version: 3.2.13
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: API Client library for Google BigQuery
|