Project

General

Profile

« Previous | Next » 

Revision 5588

sql_io.py: append_csv(): Wrap input stream in a ProgressInputStream that reports rows (rather than lines) read

View differences:

lib/sql_io.py
4 4
import csv
5 5
import operator
6 6
import warnings
7
import sys
7 8

  
8 9
import csvs
9 10
import exc
10 11
import dicts
11 12
import sql
12 13
import sql_gen
14
import streams
13 15
import strings
14 16
import util
15 17

  
......
236 238
    
237 239
    # Wrap in standardizing stream
238 240
    cols_ct = len(stream_info.header)
239
    stream = csvs.InputRewriter(csvs.ColCtFilter(csvs.make_reader(stream,
240
        dialect), cols_ct))
241
    stream = csvs.InputRewriter(streams.ProgressInputStream(csvs.StreamFilter(
242
        csvs.ColCtFilter(csvs.make_reader(stream, dialect), cols_ct)),
243
        sys.stderr, msg='Read %d row(s)', n=1000))
241 244
    dialect = stream.dialect # use default dialect
242 245
    
243 246
    # Create COPY FROM statement

Also available in: Unified diff