Ejemplo n.º 1
0
    def to_pb(self):
        """Converts the row filter to a protobuf.

        First converts to a :class:`.data_v2_pb2.ValueRange` and then uses
        it to create a row filter protobuf.

        :rtype: :class:`.data_v2_pb2.RowFilter`
        :returns: The converted current object.
        """
        value_range_kwargs = {}
        if self.start_value is not None:
            if self.inclusive_start:
                key = 'start_value_closed'
            else:
                key = 'start_value_open'
            value_range_kwargs[key] = _to_bytes(self.start_value)
        if self.end_value is not None:
            if self.inclusive_end:
                key = 'end_value_closed'
            else:
                key = 'end_value_open'
            value_range_kwargs[key] = _to_bytes(self.end_value)

        value_range = data_v2_pb2.ValueRange(**value_range_kwargs)
        return data_v2_pb2.RowFilter(value_range_filter=value_range)
Ejemplo n.º 2
0
def _ValueRangePB(*args, **kw):
    from google.cloud.bigtable._generated import (data_pb2 as data_v2_pb2)
    return data_v2_pb2.ValueRange(*args, **kw)