5252_BASE_DISABLE = 'Cloud Bigtable has no concept of enabled / disabled tables.'
5353_DISABLE_DELETE_MSG = ('The disable argument should not be used in '
5454 'delete_table(). ' ) + _BASE_DISABLE
55- _ENABLE_MSG = 'Connection.enable_table() was called, but ' + _BASE_DISABLE
56- _DISABLE_MSG = 'Connection.disable_table() was called, but ' + _BASE_DISABLE
57- _IS_ENABLED_MSG = ('Connection.is_table_enabled() was called, but ' +
58- _BASE_DISABLE )
55+ _ENABLE_TMPL = 'Connection.enable_table(%r) was called, but ' + _BASE_DISABLE
56+ _DISABLE_TMPL = 'Connection.disable_table(%r) was called, but ' + _BASE_DISABLE
57+ _IS_ENABLED_TMPL = ('Connection.is_table_enabled(%r) was called, but ' +
58+ _BASE_DISABLE )
59+ _COMPACT_TMPL = ('Connection.compact_table(%r, major=%r) was called, but the '
60+ 'Cloud Bigtable API does not support compacting a table.' )
5961
6062
6163def _get_instance (timeout = None ):
@@ -382,7 +384,8 @@ def delete_table(self, name, disable=False):
382384 name = self ._table_name (name )
383385 _LowLevelTable (name , self ._instance ).delete ()
384386
385- def enable_table (self , name ):
387+ @staticmethod
388+ def enable_table (name ):
386389 """Enable the specified table.
387390
388391 .. warning::
@@ -393,9 +396,10 @@ def enable_table(self, name):
393396 :type name: str
394397 :param name: The name of the table to be enabled.
395398 """
396- _WARN (_ENABLE_MSG )
399+ _WARN (_ENABLE_TMPL % ( name ,) )
397400
398- def disable_table (self , name ):
401+ @staticmethod
402+ def disable_table (name ):
399403 """Disable the specified table.
400404
401405 .. warning::
@@ -406,9 +410,10 @@ def disable_table(self, name):
406410 :type name: str
407411 :param name: The name of the table to be disabled.
408412 """
409- _WARN (_DISABLE_MSG )
413+ _WARN (_DISABLE_TMPL % ( name ,) )
410414
411- def is_table_enabled (self , name ):
415+ @staticmethod
416+ def is_table_enabled (name ):
412417 """Return whether the specified table is enabled.
413418
414419 .. warning::
@@ -423,22 +428,25 @@ def is_table_enabled(self, name):
423428 :rtype: bool
424429 :returns: The value :data:`True` always.
425430 """
426- _WARN (_IS_ENABLED_MSG )
431+ _WARN (_IS_ENABLED_TMPL % ( name ,) )
427432 return True
428433
429- def compact_table (self , name , major = False ):
434+ @staticmethod
435+ def compact_table (name , major = False ):
430436 """Compact the specified table.
431437
432438 .. warning::
433439
434440 Cloud Bigtable does not support compacting a table, so this
435- method does not work. It is provided simply for compatibility.
441+ method does nothing. It is provided simply for compatibility.
442+
443+ :type name: str
444+ :param name: The name of the table to compact.
436445
437- :raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
438- always
446+ :type major: bool
447+ :param major: Whether to perform a major compaction.
439448 """
440- raise NotImplementedError ('The Cloud Bigtable API does not support '
441- 'compacting a table.' )
449+ _WARN (_COMPACT_TMPL % (name , major ))
442450
443451
444452def _parse_family_option (option ):
0 commit comments