Loaded up pgsql with a pipe just today. Perl csv-preprocessor!
./col_proc.pl ./Models.txt 1,5..8 | psql -d vin -c '\copy chrome.model
+ (id,fkey_subdivision,name,date_effective,comment) FROM STDIN CSV QUO
+TE AS '~''
./col_proc delivers the functionality of filtering certain columns out of a csv, because postgres lacks that functionality nativaly any utilized columns must be located at the end of the csv.
Ie if your csv has (foo,bar,baz) and your sql table has (bar,baz) you can't selectivly take it from the csv. So I made ./col_proc.pl to only take columns asked for explicitly.
Evan Carroll
www.EvanCarroll.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.