def describe_table(self, table_name): """ Performs the DescribeTable operation """ tbl = self.get_meta_table(table_name, refresh=True) if tbl: return tbl.data else: raise TableDoesNotExist(table_name)
def describe_table(self, table_name): """ Performs the DescribeTable operation """ try: tbl = self.get_meta_table(table_name, refresh=True) if tbl: return tbl.data except ValueError: pass raise TableDoesNotExist(table_name)
def get_meta_table(self, table_name, refresh=False): """ Returns a MetaTable """ if table_name not in self._tables or refresh: operation_kwargs = {TABLE_NAME: table_name} try: data = self.dispatch(DESCRIBE_TABLE, operation_kwargs) self._tables[table_name] = MetaTable(data.get(TABLE_KEY)) except BotoCoreError as e: raise TableError("Unable to describe table: {0}".format(e)) except ClientError as e: if e.response['Error']['Code'] == 'ResourceNotFoundException': raise TableDoesNotExist(e.response['Error']['Message']) return self._tables[table_name]