Example #1
0
    def list_column_families(self):
        """List the column families owned by this table.

        :rtype: dict
        :returns: Dictionary of column families attached to this table. Keys
                  are strings (column family names) and values are
                  :class:`.ColumnFamily` instances.
        :raises: :class:`ValueError <exceptions.ValueError>` if the column
                 family name from the response does not agree with the computed
                 name from the column family ID.
        """
        request_pb = messages_pb2.GetTableRequest(name=self.name)
        client = self._cluster._client
        # We expect a `._generated.bigtable_table_data_pb2.Table`
        table_pb = client._table_stub.GetTable(request_pb, client.timeout_seconds)

        result = {}
        for column_family_id, value_pb in table_pb.column_families.items():
            gc_rule = _gc_rule_from_pb(value_pb.gc_rule)
            column_family = self.column_family(column_family_id, gc_rule=gc_rule)
            if column_family.name != value_pb.name:
                raise ValueError(
                    "Column family name %s does not agree with "
                    "name from request: %s." % (column_family.name, value_pb.name)
                )
            result[column_family_id] = column_family
        return result
Example #2
0
    def list_column_families(self):
        """List the column families owned by this table.

        :rtype: dict
        :returns: Dictionary of column families attached to this table. Keys
                  are strings (column family names) and values are
                  :class:`.column_family.ColumnFamily` instances.
        :raises: :class:`ValueError <exceptions.ValueError>` if the column
                 family name from the response does not agree with the computed
                 name from the column family ID.
        """
        request_pb = messages_pb2.GetTableRequest(name=self.name)
        client = self._cluster._client
        # We expect a `._generated.bigtable_table_data_pb2.Table`
        table_pb = client._table_stub.GetTable(request_pb,
                                               client.timeout_seconds)

        result = {}
        for column_family_id, value_pb in table_pb.column_families.items():
            gc_rule = _gc_rule_from_pb(value_pb.gc_rule)
            column_family = self.column_family(column_family_id,
                                               gc_rule=gc_rule)
            if column_family.name != value_pb.name:
                raise ValueError('Column family name %s does not agree with '
                                 'name from request: %s.' %
                                 (column_family.name, value_pb.name))
            result[column_family_id] = column_family
        return result
Example #3
0
    def list_column_families(self):
        """List the column families owned by this table.

        :rtype: dict
        :returns: Dictionary of column families attached to this table. Keys
                  are strings (column family names) and values are
                  :class:`.ColumnFamily` instances.
        :raises: :class:`ValueError <exceptions.ValueError>` if the column
                 family name from the response does not agree with the computed
                 name from the column family ID.
        """
        request_pb = table_admin_messages_v2_pb2.GetTableRequest(
            name=self.name)
        client = self._instance._client
        # We expect a `._generated.table_pb2.Table`
        table_pb = client._table_stub.GetTable(request_pb)

        result = {}
        for column_family_id, value_pb in table_pb.column_families.items():
            gc_rule = _gc_rule_from_pb(value_pb.gc_rule)
            column_family = self.column_family(column_family_id,
                                               gc_rule=gc_rule)
            result[column_family_id] = column_family
        return result
 def _callFUT(self, *args, **kwargs):
     from gcloud.bigtable.column_family import _gc_rule_from_pb
     return _gc_rule_from_pb(*args, **kwargs)
 def _callFUT(self, *args, **kwargs):
     from gcloud.bigtable.column_family import _gc_rule_from_pb
     return _gc_rule_from_pb(*args, **kwargs)