google-cloud-spanner 1.16.2 → 2.0.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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +23 -0
  4. data/lib/google-cloud-spanner.rb +10 -13
  5. data/lib/google/cloud/spanner.rb +6 -8
  6. data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
  7. data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
  8. data/lib/google/cloud/spanner/backup.rb +1 -1
  9. data/lib/google/cloud/spanner/backup/job.rb +2 -2
  10. data/lib/google/cloud/spanner/backup/job/list.rb +2 -2
  11. data/lib/google/cloud/spanner/backup/list.rb +1 -2
  12. data/lib/google/cloud/spanner/backup/restore/job.rb +2 -2
  13. data/lib/google/cloud/spanner/batch_client.rb +2 -2
  14. data/lib/google/cloud/spanner/batch_snapshot.rb +6 -8
  15. data/lib/google/cloud/spanner/batch_update.rb +1 -1
  16. data/lib/google/cloud/spanner/client.rb +8 -8
  17. data/lib/google/cloud/spanner/commit.rb +14 -14
  18. data/lib/google/cloud/spanner/convert.rb +7 -7
  19. data/lib/google/cloud/spanner/credentials.rb +2 -2
  20. data/lib/google/cloud/spanner/data.rb +2 -2
  21. data/lib/google/cloud/spanner/database.rb +22 -22
  22. data/lib/google/cloud/spanner/database/backup_info.rb +1 -1
  23. data/lib/google/cloud/spanner/database/job.rb +3 -3
  24. data/lib/google/cloud/spanner/database/job/list.rb +2 -2
  25. data/lib/google/cloud/spanner/database/list.rb +1 -1
  26. data/lib/google/cloud/spanner/database/restore_info.rb +1 -1
  27. data/lib/google/cloud/spanner/fields.rb +8 -8
  28. data/lib/google/cloud/spanner/instance.rb +5 -12
  29. data/lib/google/cloud/spanner/instance/config.rb +1 -1
  30. data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
  31. data/lib/google/cloud/spanner/instance/job.rb +2 -2
  32. data/lib/google/cloud/spanner/instance/list.rb +1 -1
  33. data/lib/google/cloud/spanner/partition.rb +4 -4
  34. data/lib/google/cloud/spanner/policy.rb +2 -2
  35. data/lib/google/cloud/spanner/service.rb +209 -297
  36. data/lib/google/cloud/spanner/session.rb +9 -9
  37. data/lib/google/cloud/spanner/snapshot.rb +2 -2
  38. data/lib/google/cloud/spanner/transaction.rb +2 -2
  39. data/lib/google/cloud/spanner/version.rb +1 -1
  40. metadata +18 -107
  41. data/lib/google/cloud/spanner/admin/database.rb +0 -149
  42. data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
  43. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
  44. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
  45. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
  46. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  47. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
  48. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
  49. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
  50. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
  51. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
  52. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
  53. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
  54. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
  55. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
  56. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
  57. data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
  58. data/lib/google/cloud/spanner/admin/instance.rb +0 -164
  59. data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
  60. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
  61. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  62. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
  63. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
  64. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
  65. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
  66. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
  67. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
  68. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
  69. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
  70. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
  71. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
  72. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
  73. data/lib/google/cloud/spanner/v1.rb +0 -16
  74. data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
  75. data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
  76. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
  77. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
  78. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
  79. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
  80. data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
  81. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
  82. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
  83. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
  84. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
  85. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
  86. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
  87. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
  88. data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
  89. data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
  90. data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
  91. data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
  92. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
  93. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
  94. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
  95. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
  96. data/lib/google/spanner/v1/keys_pb.rb +0 -34
  97. data/lib/google/spanner/v1/mutation_pb.rb +0 -39
  98. data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
  99. data/lib/google/spanner/v1/result_set_pb.rb +0 -48
  100. data/lib/google/spanner/v1/spanner_pb.rb +0 -179
  101. data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
  102. data/lib/google/spanner/v1/transaction_pb.rb +0 -56
  103. data/lib/google/spanner/v1/type_pb.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e20c16755d63cea713e0e2b48f0ad0d470e24da1429e8aa1cb62945ee6388ddd
4
- data.tar.gz: 347112cc47df35de0d4cbdb24b39447860ba4c6c5f477e46d9bdbb45ab464796
3
+ metadata.gz: 49b3d879f62998284edf63a941432c67a8caebf708f2ef4df883a3f336dbc758
4
+ data.tar.gz: e6768ee6037df38c765f888f64a4b29cc192b8a30a1bbcf02d01240c3c228621
5
5
  SHA512:
6
- metadata.gz: 14ddd7286340c3520e2b1e0bedc018b48ceef0025fe78043f92c91af5af795e7f7eed027f61659fb232135cf45d6f249d083831bb95d960c622f2cf38dbf582e
7
- data.tar.gz: 126b39a51fdd3a1673a1a8acd93548ad54ef29938b6dfc793bfd24f728eae6844ade5ca0e6780c3cfeae9aa22a31b307259585b14ec8da65e7e199c7c04393ee
6
+ metadata.gz: 3c456f4ee2482f6b0c488c749f11b508092b9c2a9befe8a4c44c74d6321c3dc1be43a6abd4cfec56c1ca7d2312feb79998383537ebd20bbe6f3d0be10f6cf576
7
+ data.tar.gz: b31fad2484409183d77bb00e11ba3526fdb9d5ae6817e8a95af51f61e09d7d3635ac7e58c99fbbb4b862b49a3092d59f7e88505aa86cb509ab1d23447ebfb060
@@ -76,7 +76,7 @@ The environment variables that google-cloud-spanner checks for project ID are:
76
76
  1. `SPANNER_PROJECT`
77
77
  2. `GOOGLE_CLOUD_PROJECT`
78
78
 
79
- The environment variables that google-cloud-spanner checks for credentials are configured on {Google::Cloud::Spanner::V1::Credentials}:
79
+ The environment variables that google-cloud-spanner checks for credentials are configured on `Google::Cloud::Spanner::V1::Spanner::Credentials`:
80
80
 
81
81
  1. `SPANNER_CREDENTIALS` - Path to JSON file, or JSON contents
82
82
  2. `SPANNER_KEYFILE` - Path to JSON file, or JSON contents
@@ -1,5 +1,28 @@
1
1
  # Release History
2
2
 
3
+ ### 2.0.0 / 2020-07-23
4
+
5
+ This is a major update that removes the "low-level" client interface code, and
6
+ instead adds `google-cloud-spanner-v1`, `google-cloud-spanner-admin-database-v1`,
7
+ and `google-cloud-spanner-admin-instance-v1` as dependencies.
8
+ The new dependencies are rewritten low-level clients, produced by a next-
9
+ generation client code generator, with improved performance and stability.
10
+
11
+ This change should have no effect on the high-level interface that most users
12
+ will use. The one exception is that the (mostly undocumented) `client_config`
13
+ argument, for adjusting low-level parameters such as RPC retry settings on
14
+ client objects, has been removed. If you need to adjust these parameters, use
15
+ the configuration interface in low-level clients.
16
+
17
+ Substantial changes have been made in the low-level interfaces, however. If you
18
+ are using the low-level classes under the old `Google::Spanner::V1` module,
19
+ please review the docs for the new `google-cloud-spanner-v1` gem. In particular:
20
+
21
+ * Some classes have been renamed, notably the client class itself.
22
+ * The client constructor takes a configuration block instead of configuration
23
+ keyword arguments.
24
+ * All RPC method arguments are now keyword arguments.
25
+
3
26
  ### 1.16.2 / 2020-05-28
4
27
 
5
28
  #### Documentation
@@ -43,8 +43,6 @@ module Google
43
43
  # * `https://www.googleapis.com/auth/spanner`
44
44
  # * `https://www.googleapis.com/auth/spanner.data`
45
45
  # @param [Integer] timeout Default timeout to use in requests. Optional.
46
- # @param [Hash] client_config A hash of values to override the default
47
- # behavior of the API client. Optional.
48
46
  # @param [String] lib_name Library name. This will be added as a prefix
49
47
  # to the API call tracking header `x-goog-api-client` with provided
50
48
  # lib version for telemetry. Optional. For example prefix looks like
@@ -75,11 +73,9 @@ module Google
75
73
  # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
76
74
  # spanner = gcloud.spanner scope: platform_scope
77
75
  #
78
- def spanner scope: nil, timeout: nil, client_config: nil, lib_name: nil,
79
- lib_version: nil
76
+ def spanner scope: nil, timeout: nil, lib_name: nil, lib_version: nil
80
77
  Google::Cloud.spanner @project, @keyfile, scope: scope,
81
78
  timeout: (timeout || @timeout),
82
- client_config: client_config,
83
79
  lib_name: lib_name,
84
80
  lib_version: lib_version
85
81
  end
@@ -107,8 +103,6 @@ module Google
107
103
  # * `https://www.googleapis.com/auth/spanner`
108
104
  # * `https://www.googleapis.com/auth/spanner.data`
109
105
  # @param [Integer] timeout Default timeout to use in requests. Optional.
110
- # @param [Hash] client_config A hash of values to override the default
111
- # behavior of the API client. Optional.
112
106
  # @param [String] lib_name Library name. This will be added as a prefix
113
107
  # to the API call tracking header `x-goog-api-client` with provided
114
108
  # lib version for telemetry. Optional. For example prefix looks like
@@ -132,13 +126,11 @@ module Google
132
126
  # spanner = Google::Cloud.spanner
133
127
  #
134
128
  def self.spanner project_id = nil, credentials = nil, scope: nil,
135
- timeout: nil, client_config: nil, lib_name: nil,
136
- lib_version: nil
129
+ timeout: nil, lib_name: nil, lib_version: nil
137
130
  require "google/cloud/spanner"
138
131
  Google::Cloud::Spanner.new project_id: project_id,
139
132
  credentials: credentials,
140
133
  scope: scope, timeout: timeout,
141
- client_config: client_config,
142
134
  lib_name: lib_name, lib_version: lib_version
143
135
  end
144
136
  end
@@ -169,16 +161,21 @@ Google::Cloud.configure.add_config! :spanner do |config|
169
161
  query_options
170
162
  end
171
163
 
164
+ default_scopes = [
165
+ "https://www.googleapis.com/auth/cloud-platform",
166
+ "https://www.googleapis.com/auth/spanner.admin",
167
+ "https://www.googleapis.com/auth/spanner.data"
168
+ ]
169
+
172
170
  config.add_field! :project_id, default_project, match: String, allow_nil: true
173
171
  config.add_alias! :project, :project_id
174
172
  config.add_field! :credentials, default_creds,
175
173
  match: [String, Hash, Google::Auth::Credentials],
176
174
  allow_nil: true
177
175
  config.add_alias! :keyfile, :credentials
178
- config.add_field! :scope, nil, match: [String, Array]
176
+ config.add_field! :scope, default_scopes, match: [String, Array]
179
177
  config.add_field! :timeout, nil, match: Integer
180
- config.add_field! :client_config, nil, match: Hash
181
- config.add_field! :endpoint, nil, match: String
178
+ config.add_field! :endpoint, "spanner.googleapis.com", match: String
182
179
  config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
183
180
  config.add_field! :lib_name, nil, match: String, allow_nil: true
184
181
  config.add_field! :lib_version, nil, match: String, allow_nil: true
@@ -59,8 +59,6 @@ module Google
59
59
  # * `https://www.googleapis.com/auth/spanner`
60
60
  # * `https://www.googleapis.com/auth/spanner.data`
61
61
  # @param [Integer] timeout Default timeout to use in requests. Optional.
62
- # @param [Hash] client_config A hash of values to override the default
63
- # behavior of the API client. Optional.
64
62
  # @param [String] endpoint Override of the endpoint host name. Optional.
65
63
  # If the param is nil, uses the default endpoint.
66
64
  # @param [String] project Alias for the `project_id` argument. Deprecated.
@@ -91,12 +89,11 @@ module Google
91
89
  # spanner = Google::Cloud::Spanner.new
92
90
  #
93
91
  def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
94
- client_config: nil, endpoint: nil, project: nil, keyfile: nil,
92
+ endpoint: nil, project: nil, keyfile: nil,
95
93
  emulator_host: nil, lib_name: nil, lib_version: nil
96
94
  project_id ||= (project || default_project_id)
97
95
  scope ||= configure.scope
98
96
  timeout ||= configure.timeout
99
- client_config ||= configure.client_config
100
97
  endpoint ||= configure.endpoint
101
98
  credentials ||= (keyfile || default_credentials(scope: scope))
102
99
  emulator_host ||= configure.emulator_host
@@ -122,8 +119,8 @@ module Google
122
119
  Spanner::Project.new(
123
120
  Spanner::Service.new(
124
121
  project_id, credentials,
125
- host: endpoint, timeout: timeout, client_config: client_config,
126
- lib_name: lib_name, lib_version: lib_version
122
+ host: endpoint, timeout: timeout, lib_name: lib_name,
123
+ lib_version: lib_version
127
124
  ),
128
125
  query_options: configure.query_options
129
126
  )
@@ -145,8 +142,6 @@ module Google
145
142
  # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
146
143
  # the set of resources and operations that the connection can access.
147
144
  # * `timeout` - (Integer) Default timeout to use in requests.
148
- # * `client_config` - (Hash) A hash of values to override the default
149
- # behavior of the API client.
150
145
  # * `endpoint` - (String) Override of the endpoint host name, or `nil`
151
146
  # to use the default endpoint.
152
147
  # * `emulator_host` - (String) Host name of the emulator. Defaults to
@@ -184,4 +179,7 @@ module Google
184
179
  end
185
180
  end
186
181
  end
182
+
183
+ # @private
184
+ Spanner = Cloud::Spanner unless const_defined? :Spanner
187
185
  end
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "googleauth"
16
+ require "google/cloud/spanner/admin/database/v1/database_admin/credentials"
17
17
 
18
18
  module Google
19
19
  module Cloud
@@ -23,7 +23,7 @@ module Google
23
23
  ##
24
24
  # @deprecated Use version-specific credentials classes
25
25
  #
26
- Credentials = Google::Cloud::Spanner::Admin::Database::V1::Credentials
26
+ Credentials = V1::DatabaseAdmin::Credentials
27
27
  end
28
28
  end
29
29
  end
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "googleauth"
16
+ require "google/cloud/spanner/admin/instance/v1/instance_admin/credentials"
17
17
 
18
18
  module Google
19
19
  module Cloud
@@ -23,7 +23,7 @@ module Google
23
23
  ##
24
24
  # @deprecated Use version-specific credentials classes
25
25
  #
26
- Credentials = Google::Cloud::Spanner::Admin::Instance::V1::Credentials
26
+ Credentials = V1::InstanceAdmin::Credentials
27
27
  end
28
28
  end
29
29
  end
@@ -296,7 +296,7 @@ module Google
296
296
  ##
297
297
  # @private
298
298
  # Creates a new Backup instance from a
299
- # {Google::Spanner::Admin::Database::V1::Backup}.
299
+ # `Google::Cloud::Spanner::Admin::Database::V1::Backup`.
300
300
  def self.from_grpc grpc, service
301
301
  new grpc, service
302
302
  end
@@ -53,7 +53,7 @@ module Google
53
53
  #
54
54
  class Job
55
55
  ##
56
- # @private The Google::Gax::Operation gRPC object.
56
+ # @private The `Gapic::Operation` gRPC object.
57
57
  attr_accessor :grpc
58
58
 
59
59
  ##
@@ -260,7 +260,7 @@ module Google
260
260
  end
261
261
 
262
262
  ##
263
- # @private New Backup::Job from a Google::Gax::Operation object.
263
+ # @private New Backup::Job from a `Gapic::Operation` object.
264
264
  def self.from_grpc grpc, service
265
265
  new.tap do |job|
266
266
  job.instance_variable_set :@grpc, grpc
@@ -146,7 +146,7 @@ module Google
146
146
  # @private
147
147
  #
148
148
  # New Backup::Job::List from a
149
- # Google::Gax::PagedEnumerable<Google::Longrunning::Operation>
149
+ # `Gapic::PagedEnumerable<Google::Longrunning::Operation>`
150
150
  # object. Operation object is a backup operation.
151
151
  #
152
152
  def self.from_grpc grpc, service
@@ -154,7 +154,7 @@ module Google
154
154
  service.databases.instance_variable_get "@operations_client"
155
155
  jobs = new(Array(grpc.response.operations).map do |job_grpc|
156
156
  Job.from_grpc \
157
- Google::Gax::Operation.new(job_grpc, operations_client),
157
+ Gapic::Operation.new(job_grpc, operations_client),
158
158
  service
159
159
  end)
160
160
  jobs.grpc = grpc
@@ -143,8 +143,7 @@ module Google
143
143
  ##
144
144
  # @private
145
145
  # New Backup::List from a
146
- # Google::Gax::PagedEnumerable<Google::Spanner::Admin::Database::\
147
- # V1::Backup>
146
+ # `Gapic::PagedEnumerable<Google::Cloud::Spanner::Admin::Database::V1::Backup>`
148
147
  # object.
149
148
  def self.from_grpc grpc, service
150
149
  backups = List.new(Array(grpc.response.backups).map do |backup|
@@ -53,7 +53,7 @@ module Google
53
53
  #
54
54
  class Job
55
55
  ##
56
- # @private The Google::Gax::Operation gRPC object.
56
+ # @private The `Gapic::Operation` gRPC object.
57
57
  attr_accessor :grpc
58
58
 
59
59
  ##
@@ -231,7 +231,7 @@ module Google
231
231
  end
232
232
 
233
233
  ##
234
- # @private New Restore::Job from a Google::Gax::Operation object.
234
+ # @private New Restore::Job from a `Gapic::Operation` object.
235
235
  def self.from_grpc grpc, service
236
236
  new.tap do |job|
237
237
  job.instance_variable_set :@grpc, grpc
@@ -407,8 +407,8 @@ module Google
407
407
  def session
408
408
  ensure_service!
409
409
  grpc = @project.service.create_session \
410
- Admin::Database::V1::DatabaseAdminClient.database_path(
411
- project_id, instance_id, database_id
410
+ V1::Spanner::Paths.database_path(
411
+ project: project_id, instance: instance_id, database: database_id
412
412
  ),
413
413
  labels: @session_labels
414
414
  Session.from_grpc grpc, @project.service, query_options: @query_options
@@ -207,7 +207,7 @@ module Google
207
207
  max_partitions: max_partitions
208
208
  results.partitions.map do |grpc|
209
209
  # Convert partition protos to execute sql request protos
210
- execute_sql_grpc = Google::Spanner::V1::ExecuteSqlRequest.new(
210
+ execute_sql_grpc = V1::ExecuteSqlRequest.new(
211
211
  {
212
212
  session: session.path,
213
213
  sql: sql,
@@ -282,7 +282,7 @@ module Google
282
282
 
283
283
  results.partitions.map do |grpc|
284
284
  # Convert partition protos to read request protos
285
- read_grpc = Google::Spanner::V1::ReadRequest.new(
285
+ read_grpc = V1::ReadRequest.new(
286
286
  {
287
287
  session: session.path,
288
288
  table: table,
@@ -663,17 +663,15 @@ module Google
663
663
  def self.load data, service: nil, query_options: nil
664
664
  data = JSON.parse data, symbolize_names: true unless data.is_a? Hash
665
665
 
666
- session_grpc = Google::Spanner::V1::Session.decode \
667
- Base64.decode64(data[:session])
668
- transaction_grpc = Google::Spanner::V1::Transaction.decode \
669
- Base64.decode64(data[:transaction])
666
+ session_grpc = V1::Session.decode Base64.decode64(data[:session])
667
+ transaction_grpc = V1::Transaction.decode Base64.decode64(data[:transaction])
670
668
 
671
669
  from_grpc transaction_grpc, Session.from_grpc(session_grpc, service, query_options: query_options)
672
670
  end
673
671
 
674
672
  ##
675
673
  # @private Creates a new BatchSnapshot instance from a
676
- # Google::Spanner::V1::Transaction.
674
+ # `Google::Cloud::Spanner::V1::Transaction`.
677
675
  def self.from_grpc grpc, session
678
676
  new grpc, session
679
677
  end
@@ -682,7 +680,7 @@ module Google
682
680
 
683
681
  # The TransactionSelector to be used for queries
684
682
  def tx_selector
685
- Google::Spanner::V1::TransactionSelector.new id: transaction_id
683
+ V1::TransactionSelector.new id: transaction_id
686
684
  end
687
685
 
688
686
  ##
@@ -155,7 +155,7 @@ module Google
155
155
  Convert.to_input_params_and_types params, types
156
156
  # param_types is a grpc map field, can't be nil
157
157
  converted_types ||= {}
158
- Google::Spanner::V1::ExecuteBatchDmlRequest::Statement.new(
158
+ V1::ExecuteBatchDmlRequest::Statement.new(
159
159
  sql: sql,
160
160
  params: converted_params,
161
161
  param_types: converted_types
@@ -1336,8 +1336,8 @@ module Google
1336
1336
  def create_new_session
1337
1337
  ensure_service!
1338
1338
  grpc = @project.service.create_session \
1339
- Admin::Database::V1::DatabaseAdminClient.database_path(
1340
- project_id, instance_id, database_id
1339
+ Admin::Database::V1::DatabaseAdmin::Paths.database_path(
1340
+ project: project_id, instance: instance_id, database: database_id
1341
1341
  ),
1342
1342
  labels: @session_labels
1343
1343
  Session.from_grpc grpc, @project.service, query_options: @query_options
@@ -1364,8 +1364,8 @@ module Google
1364
1364
  def batch_create_sessions session_count
1365
1365
  ensure_service!
1366
1366
  resp = @project.service.batch_create_sessions \
1367
- Admin::Database::V1::DatabaseAdminClient.database_path(
1368
- project_id, instance_id, database_id
1367
+ Admin::Database::V1::DatabaseAdmin::Paths.database_path(
1368
+ project: project_id, instance: instance_id, database: database_id
1369
1369
  ),
1370
1370
  session_count,
1371
1371
  labels: @session_labels
@@ -1421,9 +1421,9 @@ module Google
1421
1421
  bounded_staleness = Convert.number_to_duration \
1422
1422
  opts[:bounded_staleness] || opts[:max_staleness]
1423
1423
 
1424
- Google::Spanner::V1::TransactionSelector.new(single_use:
1425
- Google::Spanner::V1::TransactionOptions.new(read_only:
1426
- Google::Spanner::V1::TransactionOptions::ReadOnly.new({
1424
+ V1::TransactionSelector.new(single_use:
1425
+ V1::TransactionOptions.new(read_only:
1426
+ V1::TransactionOptions::ReadOnly.new({
1427
1427
  strong: opts[:strong],
1428
1428
  read_timestamp: exact_timestamp,
1429
1429
  exact_staleness: exact_staleness,
@@ -1435,7 +1435,7 @@ module Google
1435
1435
 
1436
1436
  def pdml_transaction session
1437
1437
  pdml_tx_grpc = @project.service.create_pdml session.path
1438
- Google::Spanner::V1::TransactionSelector.new id: pdml_tx_grpc.id
1438
+ V1::TransactionSelector.new id: pdml_tx_grpc.id
1439
1439
  end
1440
1440
 
1441
1441
  ##
@@ -96,8 +96,8 @@ module Google
96
96
  rows.delete_if(&:nil?)
97
97
  rows.delete_if(&:empty?)
98
98
  @mutations += rows.map do |row|
99
- Google::Spanner::V1::Mutation.new(
100
- insert_or_update: Google::Spanner::V1::Mutation::Write.new(
99
+ V1::Mutation.new(
100
+ insert_or_update: V1::Mutation::Write.new(
101
101
  table: table, columns: row.keys.map(&:to_s),
102
102
  values: [Convert.object_to_grpc_value(row.values).list_value]
103
103
  )
@@ -154,8 +154,8 @@ module Google
154
154
  rows.delete_if(&:nil?)
155
155
  rows.delete_if(&:empty?)
156
156
  @mutations += rows.map do |row|
157
- Google::Spanner::V1::Mutation.new(
158
- insert: Google::Spanner::V1::Mutation::Write.new(
157
+ V1::Mutation.new(
158
+ insert: V1::Mutation::Write.new(
159
159
  table: table, columns: row.keys.map(&:to_s),
160
160
  values: [Convert.object_to_grpc_value(row.values).list_value]
161
161
  )
@@ -211,8 +211,8 @@ module Google
211
211
  rows.delete_if(&:nil?)
212
212
  rows.delete_if(&:empty?)
213
213
  @mutations += rows.map do |row|
214
- Google::Spanner::V1::Mutation.new(
215
- update: Google::Spanner::V1::Mutation::Write.new(
214
+ V1::Mutation.new(
215
+ update: V1::Mutation::Write.new(
216
216
  table: table, columns: row.keys.map(&:to_s),
217
217
  values: [Convert.object_to_grpc_value(row.values).list_value]
218
218
  )
@@ -270,8 +270,8 @@ module Google
270
270
  rows.delete_if(&:nil?)
271
271
  rows.delete_if(&:empty?)
272
272
  @mutations += rows.map do |row|
273
- Google::Spanner::V1::Mutation.new(
274
- replace: Google::Spanner::V1::Mutation::Write.new(
273
+ V1::Mutation.new(
274
+ replace: V1::Mutation::Write.new(
275
275
  table: table, columns: row.keys.map(&:to_s),
276
276
  values: [Convert.object_to_grpc_value(row.values).list_value]
277
277
  )
@@ -306,8 +306,8 @@ module Google
306
306
  #
307
307
  def delete table, keys = []
308
308
  @mutations += [
309
- Google::Spanner::V1::Mutation.new(
310
- delete: Google::Spanner::V1::Mutation::Delete.new(
309
+ V1::Mutation.new(
310
+ delete: V1::Mutation::Delete.new(
311
311
  table: table, key_set: key_set(keys)
312
312
  )
313
313
  )
@@ -323,20 +323,20 @@ module Google
323
323
  protected
324
324
 
325
325
  def key_set keys
326
- return Google::Spanner::V1::KeySet.new all: true if keys.nil?
326
+ return V1::KeySet.new all: true if keys.nil?
327
327
  keys = [keys] unless keys.is_a? Array
328
- return Google::Spanner::V1::KeySet.new all: true if keys.empty?
328
+ return V1::KeySet.new all: true if keys.empty?
329
329
  if keys_are_ranges? keys
330
330
  key_ranges = keys.map do |r|
331
331
  Convert.to_key_range r
332
332
  end
333
- return Google::Spanner::V1::KeySet.new ranges: key_ranges
333
+ return V1::KeySet.new ranges: key_ranges
334
334
  end
335
335
  key_list = keys.map do |key|
336
336
  key = [key] unless key.is_a? Array
337
337
  Convert.object_to_grpc_value(key).list_value
338
338
  end
339
- Google::Spanner::V1::KeySet.new keys: key_list
339
+ V1::KeySet.new keys: key_list
340
340
  end
341
341
 
342
342
  def keys_are_ranges? keys