Revision 5591
Added by Aaron Marcuse-Kubitza about 12 years ago
csv2db | ||
---|---|---|
9 | 9 |
|
10 | 10 |
sys.path.append(os.path.dirname(__file__)+"/../lib") |
11 | 11 |
|
12 |
import csvs |
|
12 | 13 |
import exc |
13 | 14 |
import opts |
14 | 15 |
import sql |
... | ... | |
52 | 53 |
in_ = proc.stdout |
53 | 54 |
|
54 | 55 |
# Import data |
55 |
try: sql_io.import_csv(db, table, in_)
|
|
56 |
try: sql_io.import_csv(db, table, *csvs.reader_and_header(in_))
|
|
56 | 57 |
finally: |
57 | 58 |
in_.close() # also closes proc.stdout |
58 | 59 |
proc.wait() |
Also available in: Unified diff
sql_io.py: import_csv(): Take a reader and header rather than a stream to allow callers to pass in a wrapped CSV reader for filtering, etc.