Skip to content

Commit 35103f9

Browse files
authored
Merge pull request #1908 from tseaver/bigtable-v2-drop_table_rename
Drop 'Table.rename'.
2 parents e570b03 + f5b1719 commit 35103f9

4 files changed

Lines changed: 0 additions & 105 deletions

File tree

docs/bigtable-table-api.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@ Make a `DeleteTable`_ API request with
6565
6666
table.delete()
6767
68-
Rename an existing Table
69-
------------------------
70-
71-
Though the `RenameTable`_ API request is listed in the service
72-
definition, requests to that method return::
73-
74-
BigtableTableService.RenameTable is not yet implemented
75-
76-
We have implemented :meth:`rename() <gcloud.bigtable.table.Table.rename>`
77-
but it will not work unless the backend supports the method.
78-
7968
List Column Families in a Table
8069
-------------------------------
8170

gcloud/bigtable/table.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -176,36 +176,6 @@ def create(self, initial_split_keys=None):
176176
# We expect a `._generated.bigtable_table_data_pb2.Table`
177177
client._table_stub.CreateTable(request_pb, client.timeout_seconds)
178178

179-
def rename(self, new_table_id):
180-
"""Rename this table.
181-
182-
.. note::
183-
184-
This cannot be used to move tables between clusters,
185-
zones, or projects.
186-
187-
.. note::
188-
189-
The Bigtable Table Admin API currently (``v1``) returns
190-
191-
``BigtableTableService.RenameTable is not yet implemented``
192-
193-
when this method is used. It's unclear when this method will
194-
actually be supported by the API.
195-
196-
:type new_table_id: str
197-
:param new_table_id: The new name table ID.
198-
"""
199-
request_pb = messages_pb2.RenameTableRequest(
200-
name=self.name,
201-
new_id=new_table_id,
202-
)
203-
client = self._cluster._client
204-
# We expect a `google.protobuf.empty_pb2.Empty`
205-
client._table_stub.RenameTable(request_pb, client.timeout_seconds)
206-
207-
self.table_id = new_table_id
208-
209179
def delete(self):
210180
"""Delete this table."""
211181
request_pb = messages_pb2.DeleteTableRequest(name=self.name)

gcloud/bigtable/test_table.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -176,51 +176,6 @@ def test_create_with_split_keys(self):
176176
initial_split_keys = ['s1', 's2']
177177
self._create_test_helper(initial_split_keys)
178178

179-
def test_rename(self):
180-
from google.protobuf import empty_pb2
181-
from gcloud.bigtable._generated import (
182-
bigtable_table_service_messages_pb2 as messages_pb2)
183-
from gcloud.bigtable._testing import _FakeStub
184-
185-
project_id = 'project-id'
186-
zone = 'zone'
187-
cluster_id = 'cluster-id'
188-
table_id = 'table-id'
189-
new_table_id = 'new_table_id'
190-
timeout_seconds = 97
191-
self.assertNotEqual(new_table_id, table_id)
192-
193-
client = _Client(timeout_seconds=timeout_seconds)
194-
cluster_name = ('projects/' + project_id + '/zones/' + zone +
195-
'/clusters/' + cluster_id)
196-
cluster = _Cluster(cluster_name, client=client)
197-
table = self._makeOne(table_id, cluster)
198-
199-
# Create request_pb
200-
table_name = cluster_name + '/tables/' + table_id
201-
request_pb = messages_pb2.RenameTableRequest(
202-
name=table_name,
203-
new_id=new_table_id,
204-
)
205-
206-
# Create response_pb
207-
response_pb = empty_pb2.Empty()
208-
209-
# Patch the stub used by the API method.
210-
client._table_stub = stub = _FakeStub(response_pb)
211-
212-
# Create expected_result.
213-
expected_result = None # rename() has no return value.
214-
215-
# Perform the method and check the result.
216-
result = table.rename(new_table_id)
217-
self.assertEqual(result, expected_result)
218-
self.assertEqual(stub.method_calls, [(
219-
'RenameTable',
220-
(request_pb, timeout_seconds),
221-
{},
222-
)])
223-
224179
def _list_column_families_helper(self, column_family_name=None):
225180
from gcloud.bigtable._generated import (
226181
bigtable_table_data_pb2 as data_pb2)

system_tests/bigtable.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,25 +232,6 @@ def test_create_table(self):
232232
sorted_tables = sorted(tables, key=name_attr)
233233
self.assertEqual(sorted_tables, expected_tables)
234234

235-
def test_rename_table(self):
236-
from grpc.beta import interfaces
237-
from grpc.framework.interfaces.face import face
238-
239-
temp_table_id = 'foo-bar-baz-table'
240-
temp_table = Config.CLUSTER.table(temp_table_id)
241-
temp_table.create()
242-
self.tables_to_delete.append(temp_table)
243-
244-
with self.assertRaises(face.LocalError) as exc_manager:
245-
temp_table.rename(temp_table_id + '-alt')
246-
exc_caught = exc_manager.exception
247-
self.assertNotEqual(exc_caught, None)
248-
self.assertEqual(exc_caught.code,
249-
interfaces.StatusCode.UNIMPLEMENTED)
250-
self.assertEqual(
251-
exc_caught.details,
252-
'BigtableTableService.RenameTable is not yet implemented')
253-
254235
def test_create_column_family(self):
255236
temp_table_id = 'foo-bar-baz-table'
256237
temp_table = Config.CLUSTER.table(temp_table_id)

0 commit comments

Comments
 (0)