google-cloud-bigquery 1.60.0 → 1.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +12 -1
- data/CHANGELOG.md +9 -0
- data/lib/google/cloud/bigquery/dataset.rb +70 -3
- data/lib/google/cloud/bigquery/project.rb +22 -5
- data/lib/google/cloud/bigquery/service.rb +8 -6
- data/lib/google/cloud/bigquery/version.rb +1 -1
- data/lib/google/cloud/bigquery.rb +25 -9
- data/lib/google-cloud-bigquery.rb +19 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ae087fd9a1d2cc0921fe7b72c505fe3828add1beefa9482f4323de8759a6ef1f
|
|
4
|
+
data.tar.gz: 7390b66a15f2b1b63efd8ce65b94190f437d8f20a3184512722e41d5f9a80e3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d645597d965f183c9eefcdbbd7d5759eef90f05a68ac5210291dab1146924bb0bc3bd0b5c25f42055b4750474125123333333de177e40fb100d160af179eee62
|
|
7
|
+
data.tar.gz: c08b54e15f8fdc7177f97ee7d073ab32057bce243ce0465dc26c121a29cbf95f913f1045eaafffcf614037e13c47d37b58dd00d386f30f268def6a50425b73b5
|
data/AUTHENTICATION.md
CHANGED
|
@@ -28,6 +28,12 @@ providing **Project ID** and **Service Account Credentials** directly in code.
|
|
|
28
28
|
|
|
29
29
|
**Credentials** are discovered in the following order:
|
|
30
30
|
|
|
31
|
+
> [!WARNING]
|
|
32
|
+
> If you accept a credential configuration (JSON file or Hash) from an
|
|
33
|
+
> external source for authentication to Google Cloud, you must validate it before
|
|
34
|
+
> providing it to a Google API client library. Providing an unvalidated credential
|
|
35
|
+
> configuration to Google APIs can compromise the security of your systems and data.
|
|
36
|
+
|
|
31
37
|
1. Specify credentials in method arguments
|
|
32
38
|
2. Specify credentials in configuration
|
|
33
39
|
3. Discover credentials path in environment variables
|
|
@@ -81,11 +87,16 @@ The **Project ID** and the path to the **Credentials JSON** file can be configur
|
|
|
81
87
|
instead of placing them in environment variables or providing them as arguments.
|
|
82
88
|
|
|
83
89
|
```ruby
|
|
90
|
+
require "googleauth"
|
|
84
91
|
require "google/cloud/bigquery"
|
|
85
92
|
|
|
93
|
+
credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
94
|
+
json_key_io: ::File.open("/path/to/keyfile.json")
|
|
95
|
+
)
|
|
96
|
+
|
|
86
97
|
Google::Cloud::Bigquery.configure do |config|
|
|
87
98
|
config.project_id = "my-project-id"
|
|
88
|
-
config.credentials =
|
|
99
|
+
config.credentials = credentials
|
|
89
100
|
end
|
|
90
101
|
|
|
91
102
|
bigquery = Google::Cloud::Bigquery.new
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### 1.61.0 (2025-11-04)
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* Support fine grained ACLs ([#31772](https://github.com/googleapis/google-cloud-ruby/issues/31772))
|
|
8
|
+
#### Documentation
|
|
9
|
+
|
|
10
|
+
* add warning about loading unvalidated credentials ([#32121](https://github.com/googleapis/google-cloud-ruby/issues/32121))
|
|
11
|
+
|
|
3
12
|
### 1.60.0 (2025-10-24)
|
|
4
13
|
|
|
5
14
|
#### Features
|
|
@@ -29,6 +29,48 @@ require "google/apis/bigquery_v2"
|
|
|
29
29
|
module Google
|
|
30
30
|
module Cloud
|
|
31
31
|
module Bigquery
|
|
32
|
+
module DatasetView
|
|
33
|
+
# Provides constants for the dataset_view parameter, an optional field
|
|
34
|
+
# in the GetDatasetRequest used to specify which information about a
|
|
35
|
+
# BigQuery dataset should be returned in the response. By controlling
|
|
36
|
+
# this parameter, users can request a partial or full response, which
|
|
37
|
+
# helps enforce fine-grained access control based on their permissions.
|
|
38
|
+
|
|
39
|
+
# Default. Equivalent to `FULL`. `datasets.get` and `datasets.getIamPolicy` permissions required.
|
|
40
|
+
DATASET_VIEW_UNSPECIFIED = "DATASET_VIEW_UNSPECIFIED".freeze
|
|
41
|
+
|
|
42
|
+
# Returns metadata only. `datasets.get` permission required.
|
|
43
|
+
METADATA = "METADATA".freeze
|
|
44
|
+
|
|
45
|
+
# Returns ACLs only. `datasets.getIamPolicy` permission required.
|
|
46
|
+
ACL = "ACL".freeze
|
|
47
|
+
|
|
48
|
+
# Returns metadata and ACLs. `datasets.get` and `datasets.getIamPolicy` permissions required.
|
|
49
|
+
FULL = "FULL".freeze
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
module UpdateMode
|
|
53
|
+
# Provides constants for the update_mode parameter, an optional field
|
|
54
|
+
# in the PatchDatasetRequest and UpdateDatasetRequest used to specify
|
|
55
|
+
# whether the resource is being updated with full or partial semantics
|
|
56
|
+
# (metadata, ACLs, or both).
|
|
57
|
+
# By controlling this parameter, users can request full or partial
|
|
58
|
+
# update semantics, which helps enforce fine-grained access control
|
|
59
|
+
# based on their permissions.
|
|
60
|
+
|
|
61
|
+
# Default. Equivalent to `UPDATE_FULL`. `datasets.update` and `datasets.setIamPolicy` permissions required.
|
|
62
|
+
UPDATE_MODE_UNSPECIFIED = "UPDATE_MODE_UNSPECIFIED".freeze
|
|
63
|
+
|
|
64
|
+
# Updates both metadata and ACLs. `datasets.update` and `datasets.setIamPolicy` permissions required.
|
|
65
|
+
UPDATE_FULL = "UPDATE_FULL".freeze
|
|
66
|
+
|
|
67
|
+
# Updates only metadata. `datasets.update` permission required.
|
|
68
|
+
UPDATE_METADATA = "UPDATE_METADATA".freeze
|
|
69
|
+
|
|
70
|
+
# Updates only ACLs. `datasets.setIamPolicy` permission required.
|
|
71
|
+
UPDATE_ACL = "UPDATE_ACL".freeze
|
|
72
|
+
end
|
|
73
|
+
|
|
32
74
|
##
|
|
33
75
|
# # Dataset
|
|
34
76
|
#
|
|
@@ -63,6 +105,13 @@ module Google
|
|
|
63
105
|
# @private Access Policy Version for get, update, patch, and insert API calls
|
|
64
106
|
attr_accessor :access_policy_version
|
|
65
107
|
|
|
108
|
+
##
|
|
109
|
+
# @private The dataset_view parameter is an optional field in the GetDatasetRequest used to specify which
|
|
110
|
+
# information about a BigQuery dataset should be returned in the response. By controlling this parameter, users
|
|
111
|
+
# can request a partial or full response, which helps enforce fine-grained access control based on their
|
|
112
|
+
# permissions.
|
|
113
|
+
attr_accessor :dataset_view
|
|
114
|
+
|
|
66
115
|
##
|
|
67
116
|
# @private Create an empty Dataset object.
|
|
68
117
|
def initialize
|
|
@@ -70,6 +119,7 @@ module Google
|
|
|
70
119
|
@gapi = nil
|
|
71
120
|
@reference = nil
|
|
72
121
|
@access_policy_version = nil
|
|
122
|
+
@dataset_view = nil
|
|
73
123
|
end
|
|
74
124
|
|
|
75
125
|
##
|
|
@@ -2610,7 +2660,8 @@ module Google
|
|
|
2610
2660
|
#
|
|
2611
2661
|
def reload!
|
|
2612
2662
|
ensure_service!
|
|
2613
|
-
@gapi = service.get_project_dataset project_id, dataset_id, access_policy_version: @access_policy_version
|
|
2663
|
+
@gapi = service.get_project_dataset project_id, dataset_id, access_policy_version: @access_policy_version,
|
|
2664
|
+
dataset_view: @dataset_view
|
|
2614
2665
|
@reference = nil
|
|
2615
2666
|
@exists = nil
|
|
2616
2667
|
self
|
|
@@ -2739,11 +2790,12 @@ module Google
|
|
|
2739
2790
|
|
|
2740
2791
|
##
|
|
2741
2792
|
# @private New Dataset from a Google API Client object.
|
|
2742
|
-
def self.from_gapi gapi, conn, access_policy_version: nil
|
|
2793
|
+
def self.from_gapi gapi, conn, access_policy_version: nil, dataset_view: nil
|
|
2743
2794
|
new.tap do |f|
|
|
2744
2795
|
f.gapi = gapi
|
|
2745
2796
|
f.service = conn
|
|
2746
2797
|
f.access_policy_version = access_policy_version
|
|
2798
|
+
f.dataset_view = dataset_view
|
|
2747
2799
|
end
|
|
2748
2800
|
end
|
|
2749
2801
|
|
|
@@ -3064,10 +3116,25 @@ module Google
|
|
|
3064
3116
|
def patch_gapi! *attributes
|
|
3065
3117
|
return if attributes.empty?
|
|
3066
3118
|
ensure_service!
|
|
3119
|
+
|
|
3067
3120
|
patch_args = attributes.to_h { |attr| [attr, @gapi.send(attr)] }
|
|
3121
|
+
|
|
3122
|
+
update_mode = nil
|
|
3123
|
+
has_access_key = patch_args.key? :access
|
|
3124
|
+
other_keys_exist = (patch_args.keys - [:access]).any?
|
|
3125
|
+
|
|
3126
|
+
if has_access_key && !other_keys_exist
|
|
3127
|
+
update_mode = UpdateMode::UPDATE_ACL
|
|
3128
|
+
elsif !has_access_key && other_keys_exist
|
|
3129
|
+
update_mode = UpdateMode::UPDATE_METADATA
|
|
3130
|
+
elsif has_access_key && other_keys_exist
|
|
3131
|
+
update_mode = UpdateMode::FULL
|
|
3132
|
+
end
|
|
3133
|
+
|
|
3068
3134
|
patch_gapi = Google::Apis::BigqueryV2::Dataset.new(**patch_args)
|
|
3069
3135
|
patch_gapi.etag = etag if etag
|
|
3070
|
-
@gapi = service.patch_dataset dataset_id, patch_gapi, access_policy_version: @access_policy_version
|
|
3136
|
+
@gapi = service.patch_dataset dataset_id, patch_gapi, access_policy_version: @access_policy_version,
|
|
3137
|
+
update_mode: update_mode
|
|
3071
3138
|
end
|
|
3072
3139
|
|
|
3073
3140
|
##
|
|
@@ -1536,6 +1536,13 @@ module Google
|
|
|
1536
1536
|
# mapped to
|
|
1537
1537
|
# [IAM Policy version](https://cloud.google.com/iam/docs/policies#versions)
|
|
1538
1538
|
# and will be used to set policy in IAM.
|
|
1539
|
+
# @param [String] dataset_view The dataset_view parameter is an optional
|
|
1540
|
+
# field in the GetDatasetRequest used to specify which information
|
|
1541
|
+
# about a BigQuery dataset should be returned in the response. By
|
|
1542
|
+
# controlling this parameter, users can request a partial or full
|
|
1543
|
+
# response, which helps enforce fine-grained access control based on
|
|
1544
|
+
# their permissions. {Google::Cloud::Bigquery::DatasetView} provides
|
|
1545
|
+
# constants for this parameter.
|
|
1539
1546
|
#
|
|
1540
1547
|
# @return [Google::Cloud::Bigquery::Dataset, nil] Returns `nil` if the
|
|
1541
1548
|
# dataset does not exist.
|
|
@@ -1563,12 +1570,13 @@ module Google
|
|
|
1563
1570
|
#
|
|
1564
1571
|
# dataset = bigquery.dataset "my_dataset", skip_lookup: true
|
|
1565
1572
|
#
|
|
1566
|
-
def dataset dataset_id, skip_lookup: nil, project_id: nil, access_policy_version: nil
|
|
1573
|
+
def dataset dataset_id, skip_lookup: nil, project_id: nil, access_policy_version: nil, dataset_view: nil
|
|
1567
1574
|
ensure_service!
|
|
1568
1575
|
project_id ||= project
|
|
1569
1576
|
return Dataset.new_reference project_id, dataset_id, service if skip_lookup
|
|
1570
|
-
gapi = service.get_project_dataset project_id, dataset_id, access_policy_version: access_policy_version
|
|
1571
|
-
|
|
1577
|
+
gapi = service.get_project_dataset project_id, dataset_id, access_policy_version: access_policy_version,
|
|
1578
|
+
dataset_view: dataset_view
|
|
1579
|
+
Dataset.from_gapi gapi, service, access_policy_version: access_policy_version, dataset_view: dataset_view
|
|
1572
1580
|
rescue Google::Cloud::NotFoundError
|
|
1573
1581
|
nil
|
|
1574
1582
|
end
|
|
@@ -1601,6 +1609,14 @@ module Google
|
|
|
1601
1609
|
# mapped to
|
|
1602
1610
|
# [IAM Policy version](https://cloud.google.com/iam/docs/policies#versions)
|
|
1603
1611
|
# and will be used to set policy in IAM.
|
|
1612
|
+
# @param [String] dataset_view The dataset_view parameter is an optional
|
|
1613
|
+
# field in the GetDatasetRequest used to specify which information
|
|
1614
|
+
# about a BigQuery dataset should be returned in the response. By
|
|
1615
|
+
# controlling this parameter, users can request a partial or full
|
|
1616
|
+
# response, which helps enforce fine-grained access control based on
|
|
1617
|
+
# their permissions. {Google::Cloud::Bigquery::DatasetView} provides
|
|
1618
|
+
# constants for this parameter.
|
|
1619
|
+
#
|
|
1604
1620
|
# @yield [access] a block for setting rules
|
|
1605
1621
|
# @yieldparam [Google::Cloud::Bigquery::Dataset] access the object
|
|
1606
1622
|
# accepting rules
|
|
@@ -1633,7 +1649,8 @@ module Google
|
|
|
1633
1649
|
# end
|
|
1634
1650
|
#
|
|
1635
1651
|
def create_dataset dataset_id, name: nil, description: nil,
|
|
1636
|
-
expiration: nil, location: nil, access_policy_version: nil
|
|
1652
|
+
expiration: nil, location: nil, access_policy_version: nil,
|
|
1653
|
+
dataset_view: nil
|
|
1637
1654
|
ensure_service!
|
|
1638
1655
|
|
|
1639
1656
|
new_ds = Google::Apis::BigqueryV2::Dataset.new(
|
|
@@ -1657,7 +1674,7 @@ module Google
|
|
|
1657
1674
|
end
|
|
1658
1675
|
|
|
1659
1676
|
gapi = service.insert_dataset new_ds, access_policy_version: access_policy_version
|
|
1660
|
-
Dataset.from_gapi gapi, service, access_policy_version: access_policy_version
|
|
1677
|
+
Dataset.from_gapi gapi, service, access_policy_version: access_policy_version, dataset_view: dataset_view
|
|
1661
1678
|
end
|
|
1662
1679
|
|
|
1663
1680
|
##
|
|
@@ -109,16 +109,18 @@ module Google
|
|
|
109
109
|
|
|
110
110
|
##
|
|
111
111
|
# Returns the dataset specified by datasetID.
|
|
112
|
-
def get_dataset dataset_id, access_policy_version: nil
|
|
113
|
-
get_project_dataset @project, dataset_id, access_policy_version: access_policy_version
|
|
112
|
+
def get_dataset dataset_id, access_policy_version: nil, dataset_view: nil
|
|
113
|
+
get_project_dataset @project, dataset_id, access_policy_version: access_policy_version,
|
|
114
|
+
dataset_view: dataset_view
|
|
114
115
|
end
|
|
115
116
|
|
|
116
117
|
##
|
|
117
118
|
# Gets the specified dataset resource by full dataset reference.
|
|
118
|
-
def get_project_dataset project_id, dataset_id, access_policy_version: nil
|
|
119
|
+
def get_project_dataset project_id, dataset_id, access_policy_version: nil, dataset_view: nil
|
|
119
120
|
# The get operation is considered idempotent
|
|
120
121
|
execute backoff: true do
|
|
121
|
-
service.get_dataset project_id, dataset_id, access_policy_version: access_policy_version
|
|
122
|
+
service.get_dataset project_id, dataset_id, access_policy_version: access_policy_version,
|
|
123
|
+
dataset_view: dataset_view
|
|
122
124
|
end
|
|
123
125
|
end
|
|
124
126
|
|
|
@@ -131,7 +133,7 @@ module Google
|
|
|
131
133
|
##
|
|
132
134
|
# Updates information in an existing dataset, only replacing
|
|
133
135
|
# fields that are provided in the submitted dataset resource.
|
|
134
|
-
def patch_dataset dataset_id, patched_dataset_gapi, access_policy_version: nil
|
|
136
|
+
def patch_dataset dataset_id, patched_dataset_gapi, access_policy_version: nil, update_mode: nil
|
|
135
137
|
patch_with_backoff = false
|
|
136
138
|
options = {}
|
|
137
139
|
if patched_dataset_gapi.etag
|
|
@@ -141,7 +143,7 @@ module Google
|
|
|
141
143
|
end
|
|
142
144
|
execute backoff: patch_with_backoff do
|
|
143
145
|
service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options,
|
|
144
|
-
access_policy_version: access_policy_version
|
|
146
|
+
access_policy_version: access_policy_version, update_mode: update_mode
|
|
145
147
|
end
|
|
146
148
|
end
|
|
147
149
|
|
|
@@ -37,9 +37,26 @@ module Google
|
|
|
37
37
|
#
|
|
38
38
|
# @param [String] project_id Identifier for a BigQuery project. If not
|
|
39
39
|
# present, the default project for the credentials is used.
|
|
40
|
-
# @param [
|
|
41
|
-
#
|
|
42
|
-
#
|
|
40
|
+
# @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
|
|
41
|
+
# object. (See {Bigquery::Credentials})
|
|
42
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
43
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
44
|
+
# Google APIs can compromise the security of your systems and data.
|
|
45
|
+
#
|
|
46
|
+
# @example
|
|
47
|
+
#
|
|
48
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
49
|
+
# # on the appropriate credentials class for your environment.
|
|
50
|
+
#
|
|
51
|
+
# require "googleauth"
|
|
52
|
+
#
|
|
53
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
54
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
55
|
+
# )
|
|
56
|
+
#
|
|
57
|
+
# client = ::Google::Cloud::Bigquery.new do |config|
|
|
58
|
+
# config.credentials = credentials
|
|
59
|
+
# end
|
|
43
60
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
|
|
44
61
|
# the set of resources and operations that the connection can access.
|
|
45
62
|
# See # [Using OAuth 2.0 to Access Google #
|
|
@@ -98,12 +115,11 @@ module Google
|
|
|
98
115
|
#
|
|
99
116
|
# * `project_id` - (String) Identifier for a BigQuery project. (The
|
|
100
117
|
# parameter `project` is considered deprecated, but may also be used.)
|
|
101
|
-
# * `credentials` - (
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
# to use the default endpoint.
|
|
118
|
+
# * `credentials` - (Google::Auth::Credentials) A Google::Auth::Credentials
|
|
119
|
+
# object. (See {Bigquery::Credentials})
|
|
120
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
121
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
122
|
+
# Google APIs can compromise the security of your systems and data.
|
|
107
123
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
|
108
124
|
# the set of resources and operations that the connection can access.
|
|
109
125
|
# * `retries` - (Integer) Number of times to retry requests on server
|
|
@@ -87,9 +87,25 @@ module Google
|
|
|
87
87
|
#
|
|
88
88
|
# @param [String] project_id Identifier for a BigQuery project. If not
|
|
89
89
|
# present, the default project for the credentials is used.
|
|
90
|
-
# @param [
|
|
91
|
-
#
|
|
92
|
-
#
|
|
90
|
+
# @param [Google::Auth::Credentials] credentials A Google::Auth::Credentials
|
|
91
|
+
# object. (See {Bigquery::Credentials})
|
|
92
|
+
# @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
|
|
93
|
+
# is deprecated. Providing an unvalidated credential configuration to
|
|
94
|
+
# Google APIs can compromise the security of your systems and data.
|
|
95
|
+
#
|
|
96
|
+
# @example
|
|
97
|
+
#
|
|
98
|
+
# # The recommended way to provide credentials is to use the `make_creds` method
|
|
99
|
+
# # on the appropriate credentials class for your environment.
|
|
100
|
+
#
|
|
101
|
+
# require "googleauth"
|
|
102
|
+
#
|
|
103
|
+
# credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
|
|
104
|
+
# json_key_io: ::File.open("/path/to/keyfile.json")
|
|
105
|
+
# )
|
|
106
|
+
#
|
|
107
|
+
# client = ::Google::Cloud::Bigquery.new credentials: credentials
|
|
108
|
+
#
|
|
93
109
|
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
|
|
94
110
|
# set of resources and operations that the connection can access. See
|
|
95
111
|
# [Using OAuth 2.0 to Access Google
|