Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions gcloud/bigtable/happybase/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,51 @@ def tables(self):
if name.startswith(prefix)]

return table_names

def enable_table(self, name):
"""Enable the specified table.

Cloud Bigtable has no concept of enabled / disabled tables so this
method does not work. It is provided simply for compatibility.

:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
always
"""
raise NotImplementedError('The Cloud Bigtable API has no concept of '
'enabled or disabled tables.')

def disable_table(self, name):
"""Disable the specified table.

Cloud Bigtable has no concept of enabled / disabled tables so this
method does not work. It is provided simply for compatibility.

:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
always
"""
raise NotImplementedError('The Cloud Bigtable API has no concept of '
'enabled or disabled tables.')

def is_table_enabled(self, name):
"""Return whether the specified table is enabled.

Cloud Bigtable has no concept of enabled / disabled tables so this
method does not work. It is provided simply for compatibility.

:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
always
"""
raise NotImplementedError('The Cloud Bigtable API has no concept of '
'enabled or disabled tables.')

def compact_table(self, name, major=False):
"""Compact the specified table.

Cloud Bigtable does not support compacting a table, so this
method does not work. It is provided simply for compatibility.

:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
always
"""
raise NotImplementedError('The Cloud Bigtable API does not support '
'compacting a table.')
13 changes: 13 additions & 0 deletions gcloud/bigtable/happybase/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,16 @@ def __init__(self, name, connection):

def __repr__(self):
return '<table.Table name=%r>' % (self.name,)

def regions(self):
"""Retrieve the regions for this table.

Cloud Bigtable does not give information about how a table is laid
out in memory, so regions so this method does not work. It is
provided simply for compatibility.

:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
always
"""
raise NotImplementedError('The Cloud Bigtable API does not have a '
'concept of splitting a table into regions.')
33 changes: 33 additions & 0 deletions gcloud/bigtable/happybase/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,39 @@ def test_tables_with_prefix(self):
result = connection.tables()
self.assertEqual(result, [unprefixed_table_name1])

def test_enable_table(self):
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.enable_table(name)

def test_disable_table(self):
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.disable_table(name)

def test_is_table_enabled(self):
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.is_table_enabled(name)

def test_compact_table(self):
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
major = True
with self.assertRaises(NotImplementedError):
connection.compact_table(name, major=major)


class _Client(object):

Expand Down
8 changes: 8 additions & 0 deletions gcloud/bigtable/happybase/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ def test___repr__(self):
table = self._makeOne(name, None)
self.assertEqual(repr(table), '<table.Table name=\'table-name\'>')

def test_regions(self):
name = 'table-name'
connection = None
table = self._makeOne(name, connection)

with self.assertRaises(NotImplementedError):
table.regions()


class _Connection(object):

Expand Down