Skip to content

Commit 0f65187

Browse files
author
Jon Wayne Parrott
committed
Remove references to google.cloud.operation from spanner
1 parent f3e8d41 commit 0f65187

File tree

4 files changed

+3
-25
lines changed

4 files changed

+3
-25
lines changed

spanner/google/cloud/spanner/database.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
# pylint: disable=ungrouped-imports
2828
from google.cloud.exceptions import Conflict
2929
from google.cloud.exceptions import NotFound
30-
from google.cloud.operation import register_type
3130
from google.cloud.spanner import __version__
3231
from google.cloud.spanner._helpers import _options_with_prefix
3332
from google.cloud.spanner.batch import Batch
@@ -44,10 +43,6 @@
4443
r'databases/(?P<database_id>[a-z][a-z0-9_\-]*[a-z0-9])$'
4544
)
4645

47-
register_type(admin_v1_pb2.Database)
48-
register_type(admin_v1_pb2.CreateDatabaseMetadata)
49-
register_type(admin_v1_pb2.UpdateDatabaseDdlMetadata)
50-
5146

5247
class Database(object):
5348
"""Representation of a Cloud Spanner Database.
@@ -205,7 +200,6 @@ def create(self):
205200
))
206201
raise
207202

208-
future.caller_metadata = {'request_type': 'CreateDatabase'}
209203
return future
210204

211205
def exists(self):
@@ -252,7 +246,7 @@ def update_ddl(self, ddl_statements):
252246
See
253247
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase
254248
255-
:rtype: :class:`google.cloud.operation.Operation`
249+
:rtype: :class:`google.cloud.future.operation.Operation`
256250
:returns: an operation instance
257251
"""
258252
client = self._instance._client
@@ -267,7 +261,6 @@ def update_ddl(self, ddl_statements):
267261
raise NotFound(self.name)
268262
raise
269263

270-
future.caller_metadata = {'request_type': 'UpdateDatabaseDdl'}
271264
return future
272265

273266
def drop(self):

spanner/google/cloud/spanner/instance.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from google.cloud.exceptions import Conflict
2929
from google.cloud.exceptions import NotFound
3030
from google.cloud.iterator import GAXIterator
31-
from google.cloud.operation import register_type
3231
from google.cloud.spanner._helpers import _options_with_prefix
3332
from google.cloud.spanner.database import Database
3433
from google.cloud.spanner.pool import BurstyPool
@@ -41,10 +40,6 @@
4140

4241
DEFAULT_NODE_COUNT = 1
4342

44-
register_type(admin_v1_pb2.Instance)
45-
register_type(admin_v1_pb2.CreateInstanceMetadata)
46-
register_type(admin_v1_pb2.UpdateInstanceMetadata)
47-
4843

4944
class Instance(object):
5045
"""Representation of a Cloud Spanner Instance.
@@ -204,7 +199,7 @@ def create(self):
204199
205200
before calling :meth:`create`.
206201
207-
:rtype: :class:`google.cloud.operation.Operation`
202+
:rtype: :class:`google.cloud.future.operation.Operation`
208203
:returns: an operation instance
209204
"""
210205
api = self._client.instance_admin_api
@@ -228,7 +223,6 @@ def create(self):
228223
raise Conflict(self.name)
229224
raise
230225

231-
future.caller_metadata = {'request_type': 'CreateInstance'}
232226
return future
233227

234228
def exists(self):
@@ -285,7 +279,7 @@ def update(self):
285279
286280
before calling :meth:`update`.
287281
288-
:rtype: :class:`google.cloud.operation.Operation`
282+
:rtype: :class:`google.cloud.future.operation.Operation`
289283
:returns: an operation instance
290284
"""
291285
api = self._client.instance_admin_api
@@ -309,7 +303,6 @@ def update(self):
309303
raise NotFound(self.name)
310304
raise
311305

312-
future.caller_metadata = {'request_type': 'UpdateInstance'}
313306
return future
314307

315308
def delete(self):

spanner/tests/unit/test_database.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,6 @@ def test_create_success(self):
312312
future = database.create()
313313

314314
self.assertIs(future, op_future)
315-
self.assertEqual(future.caller_metadata,
316-
{'request_type': 'CreateDatabase'})
317315

318316
(parent, create_statement, extra_statements,
319317
options) = api._created_database
@@ -493,8 +491,6 @@ def test_update_ddl(self):
493491
future = database.update_ddl(DDL_STATEMENTS)
494492

495493
self.assertIs(future, op_future)
496-
self.assertEqual(future.caller_metadata,
497-
{'request_type': 'UpdateDatabaseDdl'})
498494

499495
name, statements, op_id, options = api._updated_database_ddl
500496
self.assertEqual(name, self.DATABASE_NAME)

spanner/tests/unit/test_instance.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ def test_create_success(self):
241241
future = instance.create()
242242

243243
self.assertIs(future, op_future)
244-
self.assertEqual(future.caller_metadata,
245-
{'request_type': 'CreateInstance'})
246244

247245
(parent, instance_id, instance, options) = api._created_instance
248246
self.assertEqual(parent, self.PARENT)
@@ -424,8 +422,6 @@ def test_update_success(self):
424422
future = instance.update()
425423

426424
self.assertIs(future, op_future)
427-
self.assertEqual(future.caller_metadata,
428-
{'request_type': 'UpdateInstance'})
429425

430426
instance, field_mask, options = api._updated_instance
431427
self.assertEqual(field_mask.paths,

0 commit comments

Comments
 (0)