Skip to content

Commit

Permalink
Remove references to google.cloud.operation from spanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott committed Jul 18, 2017
1 parent f3e8d41 commit 0f65187
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 deletions.
9 changes: 1 addition & 8 deletions spanner/google/cloud/spanner/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# pylint: disable=ungrouped-imports
from google.cloud.exceptions import Conflict
from google.cloud.exceptions import NotFound
from google.cloud.operation import register_type
from google.cloud.spanner import __version__
from google.cloud.spanner._helpers import _options_with_prefix
from google.cloud.spanner.batch import Batch
Expand All @@ -44,10 +43,6 @@
r'databases/(?P<database_id>[a-z][a-z0-9_\-]*[a-z0-9])$'
)

register_type(admin_v1_pb2.Database)
register_type(admin_v1_pb2.CreateDatabaseMetadata)
register_type(admin_v1_pb2.UpdateDatabaseDdlMetadata)


class Database(object):
"""Representation of a Cloud Spanner Database.
Expand Down Expand Up @@ -205,7 +200,6 @@ def create(self):
))
raise

future.caller_metadata = {'request_type': 'CreateDatabase'}
return future

def exists(self):
Expand Down Expand Up @@ -252,7 +246,7 @@ def update_ddl(self, ddl_statements):
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase
:rtype: :class:`google.cloud.operation.Operation`
:rtype: :class:`google.cloud.future.operation.Operation`
:returns: an operation instance
"""
client = self._instance._client
Expand All @@ -267,7 +261,6 @@ def update_ddl(self, ddl_statements):
raise NotFound(self.name)
raise

future.caller_metadata = {'request_type': 'UpdateDatabaseDdl'}
return future

def drop(self):
Expand Down
11 changes: 2 additions & 9 deletions spanner/google/cloud/spanner/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from google.cloud.exceptions import Conflict
from google.cloud.exceptions import NotFound
from google.cloud.iterator import GAXIterator
from google.cloud.operation import register_type
from google.cloud.spanner._helpers import _options_with_prefix
from google.cloud.spanner.database import Database
from google.cloud.spanner.pool import BurstyPool
Expand All @@ -41,10 +40,6 @@

DEFAULT_NODE_COUNT = 1

register_type(admin_v1_pb2.Instance)
register_type(admin_v1_pb2.CreateInstanceMetadata)
register_type(admin_v1_pb2.UpdateInstanceMetadata)


class Instance(object):
"""Representation of a Cloud Spanner Instance.
Expand Down Expand Up @@ -204,7 +199,7 @@ def create(self):
before calling :meth:`create`.
:rtype: :class:`google.cloud.operation.Operation`
:rtype: :class:`google.cloud.future.operation.Operation`
:returns: an operation instance
"""
api = self._client.instance_admin_api
Expand All @@ -228,7 +223,6 @@ def create(self):
raise Conflict(self.name)
raise

future.caller_metadata = {'request_type': 'CreateInstance'}
return future

def exists(self):
Expand Down Expand Up @@ -285,7 +279,7 @@ def update(self):
before calling :meth:`update`.
:rtype: :class:`google.cloud.operation.Operation`
:rtype: :class:`google.cloud.future.operation.Operation`
:returns: an operation instance
"""
api = self._client.instance_admin_api
Expand All @@ -309,7 +303,6 @@ def update(self):
raise NotFound(self.name)
raise

future.caller_metadata = {'request_type': 'UpdateInstance'}
return future

def delete(self):
Expand Down
4 changes: 0 additions & 4 deletions spanner/tests/unit/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ def test_create_success(self):
future = database.create()

self.assertIs(future, op_future)
self.assertEqual(future.caller_metadata,
{'request_type': 'CreateDatabase'})

(parent, create_statement, extra_statements,
options) = api._created_database
Expand Down Expand Up @@ -493,8 +491,6 @@ def test_update_ddl(self):
future = database.update_ddl(DDL_STATEMENTS)

self.assertIs(future, op_future)
self.assertEqual(future.caller_metadata,
{'request_type': 'UpdateDatabaseDdl'})

name, statements, op_id, options = api._updated_database_ddl
self.assertEqual(name, self.DATABASE_NAME)
Expand Down
4 changes: 0 additions & 4 deletions spanner/tests/unit/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ def test_create_success(self):
future = instance.create()

self.assertIs(future, op_future)
self.assertEqual(future.caller_metadata,
{'request_type': 'CreateInstance'})

(parent, instance_id, instance, options) = api._created_instance
self.assertEqual(parent, self.PARENT)
Expand Down Expand Up @@ -424,8 +422,6 @@ def test_update_success(self):
future = instance.update()

self.assertIs(future, op_future)
self.assertEqual(future.caller_metadata,
{'request_type': 'UpdateInstance'})

instance, field_mask, options = api._updated_instance
self.assertEqual(field_mask.paths,
Expand Down

0 comments on commit 0f65187

Please sign in to comment.