google-cloud-bigquery 1.52.1 → 1.55.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.
@@ -723,6 +723,8 @@ module Google
723
723
  # identifying the result set.
724
724
  # @param [Integer] max Maximum number of results to return.
725
725
  # @param [Integer] start Zero-based index of the starting row to read.
726
+ # @param [Boolean] format_options_use_int64_timestamp Output timestamp
727
+ # as usec int64. Default is true.
726
728
  #
727
729
  # @return [Google::Cloud::Bigquery::Data] An object providing access to
728
730
  # data read from the destination table for the job.
@@ -745,20 +747,21 @@ module Google
745
747
  # # Retrieve the next page of results
746
748
  # data = data.next if data.next?
747
749
  #
748
- def data token: nil, max: nil, start: nil
750
+ def data token: nil, max: nil, start: nil, format_options_use_int64_timestamp: true
749
751
  return nil unless done?
750
- return Data.from_gapi_json({ rows: [] }, nil, @gapi, service) if dryrun?
752
+ return Data.from_gapi_json({ rows: [] }, nil, @gapi, service, format_options_use_int64_timestamp) if dryrun?
751
753
  if ddl? || dml? || !ensure_schema!
752
754
  data_hash = { totalRows: nil, rows: [] }
753
- return Data.from_gapi_json data_hash, nil, @gapi, service
755
+ return Data.from_gapi_json data_hash, nil, @gapi, service, format_options_use_int64_timestamp
754
756
  end
755
757
 
756
758
  data_hash = service.list_tabledata destination_table_dataset_id,
757
759
  destination_table_table_id,
758
760
  token: token,
759
761
  max: max,
760
- start: start
761
- Data.from_gapi_json data_hash, destination_table_gapi, @gapi, service
762
+ start: start,
763
+ format_options_use_int64_timestamp: format_options_use_int64_timestamp
764
+ Data.from_gapi_json data_hash, destination_table_gapi, @gapi, service, format_options_use_int64_timestamp
762
765
  end
763
766
  alias query_results data
764
767
 
@@ -690,6 +690,59 @@ module Google
690
690
  @gapi.determinism_level == "NOT_DETERMINISTIC"
691
691
  end
692
692
 
693
+ ##
694
+ # The data governance type of the routine. Optional.
695
+ #
696
+ # If set to `DATA_MASKING`, the function is validated and made
697
+ # available as a masking function. For more information, see [Create custom
698
+ # masking routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
699
+ #
700
+ # @return [String, nil] The data governance type, or `nil` if not set or the object is a reference
701
+ # (see {#reference?}).
702
+ #
703
+ # @example
704
+ # require "google/cloud/bigquery"
705
+ #
706
+ # bigquery = Google::Cloud::Bigquery.new
707
+ # dataset = bigquery.dataset "my_dataset"
708
+ # routine = dataset.routine "my_routine"
709
+ #
710
+ # routine.data_governance_type #=> "DATA_MASKING"
711
+ #
712
+ # @!group Attributes
713
+ #
714
+ def data_governance_type
715
+ return nil if reference?
716
+ ensure_full_data!
717
+ @gapi.data_governance_type
718
+ end
719
+
720
+ ##
721
+ # Updates the data governance type of the routine. Optional.
722
+ #
723
+ # If set to `DATA_MASKING`, the function is validated and made
724
+ # available as a masking function. For more information, see [Create custom
725
+ # masking routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
726
+ #
727
+ # @param [String, nil] new_data_governance_type The new data governance type. `nil` to unset.
728
+ #
729
+ # @example
730
+ # require "google/cloud/bigquery"
731
+ #
732
+ # bigquery = Google::Cloud::Bigquery.new
733
+ # dataset = bigquery.dataset "my_dataset"
734
+ # routine = dataset.routine "my_routine"
735
+ #
736
+ # routine.data_governance_type = "DATA_MASKING"
737
+ #
738
+ # @!group Attributes
739
+ #
740
+ def data_governance_type= new_data_governance_type
741
+ ensure_full_data!
742
+ @gapi.data_governance_type = new_data_governance_type
743
+ update_gapi!
744
+ end
745
+
693
746
  ##
694
747
  # Updates the routine with changes made in the given block in a single update request. The following attributes
695
748
  # may be set: {Updater#routine_type=}, {Updater#language=}, {Updater#arguments=}, {Updater#return_type=},
@@ -1198,6 +1251,30 @@ module Google
1198
1251
  @gapi.determinism_level = new_determinism_level
1199
1252
  end
1200
1253
 
1254
+ ##
1255
+ # Updates the data governance type of the routine. Optional.
1256
+ #
1257
+ # If set to `DATA_MASKING`, the function is validated and made
1258
+ # available as a masking function. For more information, see [Create custom
1259
+ # masking routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask).
1260
+ #
1261
+ # @param [String, nil] new_data_governance_type The new data governance type. `nil` to unset.
1262
+ #
1263
+ # @example
1264
+ # require "google/cloud/bigquery"
1265
+ #
1266
+ # bigquery = Google::Cloud::Bigquery.new
1267
+ # dataset = bigquery.dataset "my_dataset"
1268
+ # routine = dataset.routine "my_routine"
1269
+ #
1270
+ # routine.data_governance_type = "DATA_MASKING"
1271
+ #
1272
+ # @!group Attributes
1273
+ #
1274
+ def data_governance_type= new_data_governance_type
1275
+ @gapi.data_governance_type = new_data_governance_type
1276
+ end
1277
+
1201
1278
  def update
1202
1279
  raise "not implemented in #{self.class}"
1203
1280
  end
@@ -109,29 +109,29 @@ module Google
109
109
 
110
110
  ##
111
111
  # Returns the dataset specified by datasetID.
112
- def get_dataset dataset_id
113
- get_project_dataset @project, dataset_id
112
+ def get_dataset dataset_id, access_policy_version: nil
113
+ get_project_dataset @project, dataset_id, access_policy_version: access_policy_version
114
114
  end
115
115
 
116
116
  ##
117
117
  # Gets the specified dataset resource by full dataset reference.
118
- def get_project_dataset project_id, dataset_id
118
+ def get_project_dataset project_id, dataset_id, access_policy_version: nil
119
119
  # The get operation is considered idempotent
120
120
  execute backoff: true do
121
- service.get_dataset project_id, dataset_id
121
+ service.get_dataset project_id, dataset_id, access_policy_version: access_policy_version
122
122
  end
123
123
  end
124
124
 
125
125
  ##
126
126
  # Creates a new empty dataset.
127
- def insert_dataset new_dataset_gapi
128
- execute { service.insert_dataset @project, new_dataset_gapi }
127
+ def insert_dataset new_dataset_gapi, access_policy_version: nil
128
+ execute { service.insert_dataset @project, new_dataset_gapi, access_policy_version: access_policy_version }
129
129
  end
130
130
 
131
131
  ##
132
132
  # Updates information in an existing dataset, only replacing
133
133
  # fields that are provided in the submitted dataset resource.
134
- def patch_dataset dataset_id, patched_dataset_gapi
134
+ def patch_dataset dataset_id, patched_dataset_gapi, access_policy_version: nil
135
135
  patch_with_backoff = false
136
136
  options = {}
137
137
  if patched_dataset_gapi.etag
@@ -140,7 +140,8 @@ module Google
140
140
  patch_with_backoff = true
141
141
  end
142
142
  execute backoff: patch_with_backoff do
143
- service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options
143
+ service.patch_dataset @project, dataset_id, patched_dataset_gapi, options: options,
144
+ access_policy_version: access_policy_version
144
145
  end
145
146
  end
146
147
 
@@ -244,7 +245,8 @@ module Google
244
245
 
245
246
  ##
246
247
  # Retrieves data from the table.
247
- def list_tabledata dataset_id, table_id, max: nil, token: nil, start: nil
248
+ def list_tabledata dataset_id, table_id, max: nil, token: nil, start: nil,
249
+ format_options_use_int64_timestamp: nil
248
250
  # The list operation is considered idempotent
249
251
  execute backoff: true do
250
252
  json_txt = service.list_table_data \
@@ -252,7 +254,8 @@ module Google
252
254
  max_results: max,
253
255
  page_token: token,
254
256
  start_index: start,
255
- options: { skip_deserialization: true }
257
+ options: { skip_deserialization: true },
258
+ format_options_use_int64_timestamp: format_options_use_int64_timestamp
256
259
  JSON.parse json_txt, symbolize_names: true
257
260
  end
258
261
  end
@@ -456,7 +459,8 @@ module Google
456
459
 
457
460
  ##
458
461
  # Returns the query data for the job
459
- def job_query_results job_id, location: nil, max: nil, token: nil, start: nil, timeout: nil
462
+ def job_query_results job_id, location: nil, max: nil, token: nil,
463
+ start: nil, timeout: nil, format_options_use_int64_timestamp: nil
460
464
  # The get operation is considered idempotent
461
465
  execute backoff: true do
462
466
  service.get_job_query_results @project, job_id,
@@ -464,7 +468,8 @@ module Google
464
468
  max_results: max,
465
469
  page_token: token,
466
470
  start_index: start,
467
- timeout_ms: timeout
471
+ timeout_ms: timeout,
472
+ format_options_use_int64_timestamp: format_options_use_int64_timestamp
468
473
  end
469
474
  end
470
475
 
@@ -1017,6 +1017,77 @@ module Google
1017
1017
  patch_gapi! :labels
1018
1018
  end
1019
1019
 
1020
+ ##
1021
+ # The resource tags associated with this table. Tag keys are globally unique.
1022
+ #
1023
+ # @see https://cloud.google.com/iam/docs/tags-access-control#definitions
1024
+ # For additional information on tags.
1025
+ #
1026
+ # The returned hash is frozen and changes are not allowed. Use
1027
+ # {#resource_tags=} to replace the entire hash.
1028
+ #
1029
+ # @return [Hash<String, String>, nil] A hash containing key/value pairs.
1030
+ #
1031
+ # * The key is the namespaced friendly name of the tag key, e.g.
1032
+ # "12345/environment" where 12345 is the ID of the parent organization
1033
+ # or project resource for this tag key.
1034
+ # * The value is the friendly short name of the tag value, e.g. "production".
1035
+ #
1036
+ # @example
1037
+ # require "google/cloud/bigquery"
1038
+ #
1039
+ # bigquery = Google::Cloud::Bigquery.new
1040
+ # dataset = bigquery.dataset "my_dataset"
1041
+ # table = dataset.table "my_table"
1042
+ #
1043
+ # resource_tags = table.resource_tags
1044
+ # resource_tags["12345/environment"] #=> "production"
1045
+ #
1046
+ # @!group Attributes
1047
+ #
1048
+ def resource_tags
1049
+ return nil if reference?
1050
+ m = @gapi.resource_tags
1051
+ m = m.to_h if m.respond_to? :to_h
1052
+ m.dup.freeze
1053
+ end
1054
+
1055
+ ##
1056
+ # Updates the resource tags associated with this table. Tag keys are globally
1057
+ # unique.
1058
+ #
1059
+ # @see https://cloud.google.com/iam/docs/tags-access-control#definitions
1060
+ # For additional information on tags.
1061
+ #
1062
+ # If the table is not a full resource representation (see
1063
+ # {#resource_full?}), the full representation will be retrieved before
1064
+ # the update to comply with ETag-based optimistic concurrency control.
1065
+ #
1066
+ # @param [Hash<String, String>] resource_tags A hash containing key/value
1067
+ # pairs.
1068
+ #
1069
+ # * The key is the namespaced friendly name of the tag key, e.g.
1070
+ # "12345/environment" where 12345 is the ID of the parent organization
1071
+ # or project resource for this tag key.
1072
+ # * The value is the friendly short name of the tag value, e.g. "production".
1073
+ #
1074
+ # @example
1075
+ # require "google/cloud/bigquery"
1076
+ #
1077
+ # bigquery = Google::Cloud::Bigquery.new
1078
+ # dataset = bigquery.dataset "my_dataset"
1079
+ # table = dataset.table "my_table"
1080
+ #
1081
+ # table.resource_tags = { "12345/environment" => "production" }
1082
+ #
1083
+ # @!group Attributes
1084
+ #
1085
+ def resource_tags= resource_tags
1086
+ reload! unless resource_full?
1087
+ @gapi.resource_tags = resource_tags
1088
+ patch_gapi! :resource_tags
1089
+ end
1090
+
1020
1091
  ##
1021
1092
  # Returns the table's schema. If the table is not a view (See {#view?}),
1022
1093
  # this method can also be used to set, replace, or add to the schema by
@@ -1630,6 +1701,8 @@ module Google
1630
1701
  #
1631
1702
  # @param [Integer] max Maximum number of results to return.
1632
1703
  # @param [Integer] start Zero-based index of the starting row to read.
1704
+ # @param [Boolean] format_options_use_int64_timestamp Output timestamp
1705
+ # as usec int64. Default is true.
1633
1706
  #
1634
1707
  # @return [Google::Cloud::Bigquery::Data]
1635
1708
  #
@@ -1664,11 +1737,12 @@ module Google
1664
1737
  #
1665
1738
  # @!group Data
1666
1739
  #
1667
- def data token: nil, max: nil, start: nil
1740
+ def data token: nil, max: nil, start: nil, format_options_use_int64_timestamp: true
1668
1741
  ensure_service!
1669
1742
  reload! unless resource_full?
1670
- data_json = service.list_tabledata dataset_id, table_id, token: token, max: max, start: start
1671
- Data.from_gapi_json data_json, gapi, nil, service
1743
+ data_json = service.list_tabledata dataset_id, table_id, token: token, max: max, start: start,
1744
+ format_options_use_int64_timestamp: format_options_use_int64_timestamp
1745
+ Data.from_gapi_json data_json, gapi, nil, service, format_options_use_int64_timestamp
1672
1746
  end
1673
1747
 
1674
1748
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigquery
19
- VERSION = "1.52.1".freeze
19
+ VERSION = "1.55.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-bigquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.52.1
4
+ version: 1.55.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-04-25 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: google-apis-core
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0.18'
62
+ - - "<"
60
63
  - !ruby/object:Gem::Version
61
- version: '0.13'
64
+ version: '2'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0.18'
72
+ - - "<"
67
73
  - !ruby/object:Gem::Version
68
- version: '0.13'
74
+ version: '2'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: googleauth
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +134,7 @@ files:
128
134
  - lib/google-cloud-bigquery.rb
129
135
  - lib/google/cloud/bigquery.rb
130
136
  - lib/google/cloud/bigquery/argument.rb
137
+ - lib/google/cloud/bigquery/condition.rb
131
138
  - lib/google/cloud/bigquery/convert.rb
132
139
  - lib/google/cloud/bigquery/copy_job.rb
133
140
  - lib/google/cloud/bigquery/credentials.rb
@@ -187,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
194
  - !ruby/object:Gem::Version
188
195
  version: '0'
189
196
  requirements: []
190
- rubygems_version: 3.6.5
197
+ rubygems_version: 3.6.9
191
198
  specification_version: 4
192
199
  summary: API Client library for Google BigQuery
193
200
  test_files: []