Project

General

Profile

« Previous | Next » 

Revision 6385

bin/map: Support map spreadsheets containing only metadata mappings (with no corresponding staging table), by falling back to an empty table when the named table does not exist

View differences:

map
353 353
            # Fetch rows
354 354
            if by_col: limit = 0 # only fetch column names
355 355
            else: limit = n
356
            cur = sql.select(in_db, table, limit=limit, start=start,
357
                cacheable=False)
358
            col_names = list(sql.col_names(cur))
356
            try:
357
                cur = sql.select(in_db, table, limit=limit, start=start,
358
                    recover=True, cacheable=False)
359
            except sql.DoesNotExistException:
360
                col_names = []
361
                rows = []
362
            else:
363
                col_names = list(sql.col_names(cur))
364
                rows = sql.rows(cur)
359 365
            
360 366
            if by_col:
361 367
                map_table(col_names, []) # just create the template
......
378 384
                row_ct = in_row_ct_ref[0]
379 385
            else:
380 386
                # Use normal by-row method
381
                row_ct = map_table(col_names, sql.rows(cur), rows_start=start)
387
                row_ct = map_table(col_names, rows, rows_start=start)
382 388
                    # rows_start: pre-start rows have been skipped
383 389
                
384 390
                in_db.db.close()

Also available in: Unified diff