def get_range(self, start="", finish="", columns=None, column_start="",
                  column_finish="", column_reversed=False, column_count=100,
                  row_count=None, include_timestamp=False,
                  super_column=None, read_consistency_level=None,
                  buffer_size=None, filter_empty=True, include_ttl=False,
                  start_token=None, finish_token=None):

        cl = read_consistency_level or self.read_consistency_level
        cp = self._column_parent(super_column)
        sp = self._slice_predicate(columns, column_start, column_finish,
                                   column_reversed, column_count, super_column)

        kr_args = {}
        count = 0
        i = 0

        if start_token is not None and (start not in ("", None) or finish not in ("", None)):
            raise ValueError(
                "ColumnFamily.get_range() received incompatible arguments: "
                "'start_token' may not be used with 'start' or 'finish'")

        if finish_token is not None and finish not in ("", None):
            raise ValueError(
                "ColumnFamily.get_range() received incompatible arguments: "
                "'finish_token' may not be used with 'finish'")

        if start_token is not None:
            kr_args['start_token'] = start_token
            kr_args['end_token'] = "" if finish_token is None else finish_token
        elif finish_token is not None:
            kr_args['start_key'] = self._pack_key(start)
            kr_args['end_token'] = finish_token
        else:
            kr_args['start_key'] = self._pack_key(start)
            kr_args['end_key'] = self._pack_key(finish)

        if buffer_size is None:
            buffer_size = self.buffer_size
        while True:
            if row_count is not None:
                if i == 0 and row_count <= buffer_size:
                    # We don't need to chunk, grab exactly the number of rows
                    buffer_size = row_count
                else:
                    buffer_size = min(row_count - count + 1, buffer_size)
            kr_args['count'] = buffer_size
            key_range = KeyRange(**kr_args)
            key_slices = self.pool.execute('get_range_slices', cp, sp, key_range, cl)
            # This may happen if nothing was ever inserted
            if key_slices is None:
                return
            for j, key_slice in enumerate(key_slices):
                # Ignore the first element after the first iteration
                # because it will be a duplicate.
                if j == 0 and i != 0:
                    continue
                if filter_empty and not key_slice.columns:
                    continue
                yield (self._unpack_key(key_slice.key),
                       self._cosc_to_dict(key_slice.columns, include_timestamp, include_ttl))
                count += 1
                if row_count is not None and count >= row_count:
                    return

            if len(key_slices) != buffer_size:
                return
            if 'start_token' in kr_args:
                del kr_args['start_token']
            kr_args['start_key'] = key_slices[-1].key
            i += 1
Get an iterator over rows in a specified key range.
dataset/ETHPy150Open pycassa/pycassa/pycassa/columnfamily.py/ColumnFamily.get_range