Project

General

Profile

« Previous | Next » 

Revision 146

db_xml.get(): Pass limit through to SQL query

View differences:

map
24 24
    def usage_err():
25 25
        raise SystemExit('Usage: '+opts.env_usage(env_names, True)
26 26
            +' [commit=1] '+sys.argv[0]+' [map_path] [<input] [>output]')
27
    limit = int(opts.get_env_var('n', sys.maxint, env_names))
27
    limit = opts.get_env_var('n', None, env_names)
28
    if limit != None: limit = int(limit)
28 29
    commit = opts.env_flag('commit')
29 30
    
30 31
    # Get db config from env vars
......
92 93
            in_db = sql.connect(in_db_config)
93 94
            in_pkeys = {}
94 95
            for row_idx, row in enumerate(sql.rows(db_xml.get(in_db,
95
                src_root_xml, in_pkeys))):
96
                if not row_idx < limit: break
96
                src_root_xml, in_pkeys, limit))):
97 97
                row_id, = row
98 98
                row_id = str(row_id)
99 99
                
......
112 112
            reader = csv.reader(sys.stdin)
113 113
            cols = reader.next()
114 114
            for row_idx, row in enumerate(reader):
115
                if not row_idx < limit: break
115
                if not (limit == None or row_idx < limit): break
116 116
                row_id = str(row_idx)
117 117
                
118 118
                def put_col(path, value):

Also available in: Unified diff