Project

General

Profile

« Previous | Next » 

Revision 947

bin/map: Added redo option to control whether the database is emptied before inserting new data. Can be used to turn off emptying the DB in test mode, because this is often slow and is not needed if you are running tests on an empty testing database.

View differences:

bin/map
45 45
    start = util.cast(int, opts.get_env_var('start', '0', env_names))
46 46
    if end != None: end += start
47 47
    test = opts.env_flag('test', False, env_names)
48
    commit = not test and opts.env_flag('commit', False, env_names)
48
    commit = opts.env_flag('commit', False, env_names) and not test
49 49
        # never commit in test mode
50
    redo = opts.env_flag('redo', test, env_names) and not commit
51
        # never redo in commit mode (manually run `make empty_db` instead)
50 52
    debug = opts.env_flag('debug', False, env_names)
51 53
    sql.run_raw_query.debug = debug
52 54
    verbose = debug or opts.env_flag('verbose', False, env_names)
......
200 202
        out_db = connect_db(out_db_config)
201 203
        out_pkeys = {}
202 204
        try:
203
            if test: sql.empty_db(out_db)
205
            if redo: sql.empty_db(out_db)
204 206
            row_ct_ref = [0]
205 207
            
206 208
            def row_ready(row_num, input_row):

Also available in: Unified diff