def do_scan(self, line):
        """
        scan [:tablename] [--batch=#] [-{max}] [+filter_attribute=filter_value] [attributes,...]

        filter_attribute is either the field name to filter on or a field name with a conditional, as specified in boto's documentation,
        in the form of {name}__{conditional} where conditional is:

            eq (equal value)
            ne {value} (not equal value)
            lte (less or equal then value)
            lt (less then value)
            gte (greater or equal then value)
            gt (greater then value)
            null (value is null / does not exists - pass true/false)
            contains (contains value)
            ncontains (does not contains value)
            beginswith (attribute begins with value)
            in (value in range)
            between (between value1 and value2 - use: between=value1,value2)
        """

        table, line = self.get_table_params(line)
        args = self.getargs(line)

        scan_filter = {}
        #count = False
        as_array = False
        max_size = None
        batch_size = None
        start = None
        cond = None

        while args:
            if args[0].startswith('+'):
                arg = args.pop(0)
                filter_name, filter_value = arg[1:].split('=', 1)

                if "__" not in filter_name:
                    filter_name += "__eq"

                if filter_name.endswith("__null"):
                    scan_filter[filter_name] = filter_value == "true"
                else:
                    scan_filter[filter_name] = self.get_typed_value(filter_name, filter_value)

            elif args[0].startswith('--batch='):
                arg = args.pop(0)
                batch_size = int(arg[8:])

            elif args[0].startswith('--max='):
                arg = args.pop(0)
                max_size = int(arg[6:])

            elif args[0].startswith('--start='):
                arg = args.pop(0)
                start = (arg[8:], )

            elif args[0] == "--and":
                args.pop(0)
                cond = "AND"

            elif args[0] == "--or":
                args.pop(0)
                cond = "OR"

            elif args[0] == '--next':
                arg = args.pop(0)
                if self.next_key:
                    start = self.next_key
                else:
                    print "no next"
                    return

            elif args[0] == '-a' or args[0] == '--array':
                as_array = True
                args.pop(0)

            elif args[0].startswith('-'):
                arg = args.pop(0)

                #if arg == '-c' or arg == '--count':
                #    count = True

                if arg[0] == '-' and arg[1:].isdigit():
                    max_size = int(arg[1:])

                elif arg == '--':
                    break

                else:
                    print "invalid argument: %s" % arg
                    break

            else:
                break

        attr_keys = args[0].split(",") if args else None
        attrs = list(set(attr_keys)) if attr_keys else None

        result = table.scan(limit=max_size, max_page_size=batch_size, attributes=attrs, conditional_operator=cond, exclusive_start_key=start, **scan_filter)

        #
        # enable this if you want to see when pages are fetched
        #
        if False:
            _fetch_more = result.fetch_more
            def fetch_more():
                print "==== fetch page ===="
                _fetch_more()

            result.fetch_more = fetch_more

        if False: # count:
            print "count: %s/%s" % (result.scanned_count, result.count)
            self.next_key = None
        else:
            if as_array and attr_keys:
                self.print_iterator_array(result, attr_keys)
            else:
                self.print_iterator(result)

            self.next_key = result._last_key_seen

        if self.consumed:
            print "consumed units:", result.consumed_units
def do_scan ( self , line ) : table , line = self . get_table_params ( line ) args = self . getargs ( line ) scan_filter = { } as_array = False max_size = None batch_size = None start = None cond = None while args : if args [ 0 ] . startswith ( '+' ) : arg = args . pop ( 0 ) filter_name , filter_value = arg [ 1 : ] . split ( '=' , 1 ) if "__" not in filter_name : filter_name += "__eq" if filter_name . endswith ( "__null" ) : scan_filter [ filter_name ] = filter_value == "true" else : scan_filter [ filter_name ] = self . get_typed_value ( filter_name , filter_value ) elif args [ 0 ] . startswith ( '--batch=' ) : arg = args . pop ( 0 ) batch_size = int ( arg [ 8 : ] ) elif args [ 0 ] . startswith ( '--max=' ) : arg = args . pop ( 0 ) max_size = int ( arg [ 6 : ] ) elif args [ 0 ] . startswith ( '--start=' ) : arg = args . pop ( 0 ) start = ( arg [ 8 : ] , ) elif args [ 0 ] == "--and" : args . pop ( 0 ) cond = "AND" elif args [ 0 ] == "--or" : args . pop ( 0 ) cond = "OR" elif args [ 0 ] == '--next' : arg = args . pop ( 0 ) if self . next_key : start = self . next_key else : print "no next" return elif args [ 0 ] == '-a' or args [ 0 ] == '--array' : as_array = True args . pop ( 0 ) elif args [ 0 ] . startswith ( '-' ) : arg = args . pop ( 0 ) if arg [ 0 ] == '-' and arg [ 1 : ] . isdigit ( ) : max_size = int ( arg [ 1 : ] ) elif arg == '--' : break else : print "invalid argument: %s" % arg break else : break attr_keys = args [ 0 ] . split ( "," ) if args else None attrs = list ( set ( attr_keys ) ) if attr_keys else None result = table . scan ( limit = max_size , max_page_size = batch_size , attributes = attrs , conditional_operator = cond , exclusive_start_key = start , ** scan_filter ) if False : _fetch_more = result . fetch_more def fetch_more ( ) : print "==== fetch page ====" _fetch_more ( ) result . fetch_more = fetch_more if False : print "count: %s/%s" % ( result . scanned_count , result . count ) self . next_key = None else : if as_array and attr_keys : self . print_iterator_array ( result , attr_keys ) else : self . print_iterator ( result ) self . next_key = result . _last_key_seen if self . consumed : print "consumed units:" , result . consumed_units
scan [:tablename] [--batch=#] [-{max}] [+filter_attribute=filter_value] [attributes,...]

        filter_attribute is either the field name to filter on or a field name with a conditional, as specified in boto's documentation,
        in the form of {name}__{conditional} where conditional is:

            eq (equal value)
            ne {value} (not equal value)
            lte (less or equal then value)
            lt (less then value)
            gte (greater or equal then value)
            gt (greater then value)
            null (value is null / does not exists - pass true/false)
            contains (contains value)
            ncontains (does not contains value)
            beginswith (attribute begins with value)
            in (value in range)
            between (between value1 and value2 - use: between=value1,value2)