Thanks Viktor, but no dice. I also tried converting from CSV to
TAB-delim to match what you were doing, but it's still not working...
$ mclient -s "copy into testdata from STDIN using delimiters
',','\n','';" testdb - < /tmp/testdata.csv
syntax error, unexpected IDENT in: "spy"
$ sed 's/,/\'$'\t''/g' /tmp/testdata.csv > /tmp/testdata.dat
$ mclient -s "copy into testdata from STDIN;" testdb - < /tmp/testdata.dat
syntax error, unexpected IDENT in: "spy"
$ mclient -s "copy into testdata from STDIN using delimiters
'\t','\n','';" testdb - < /tmp/testdata.dat
syntax error, unexpected IDENT in: "spy"
I'm understanding the format of the documentation quite a bit better
now after spending a few days with it, but I'm still not clear on why
this insert is failing.
I went one step further and converted the input file to single-quote
the string fields, but this fails as well:
$ mclient -s "copy into testdata from STDIN using delimiters
',','\n','\'';" testdb - < /tmp/testdata2.csv
syntax error, unexpected STRING in: "'testvalue1'"
The problem has to be something trivial, but I have no idea what it is...
On Sat, Nov 12, 2011 at 5:30 AM, Viktor Rosenfeld
Hi Sean,
Sean McNamara wrote:
$ mclient -s "copy 2519931 records into testdata from STDIN using delimiters ',';" testdb - < /tmp/testdata.csv syntax error, unexpected IDENT in: "testvalue1"
where testvalue1 is one of the actual values in the FOO column (actually the only value in this particular file.)
I'm wondering if this is telling me it's expecting the field to be quoted, but that seems unlikely as it would make working with CSVs quite a bit painful.
Can you guys kindly help me take another step forward. I really appreciate the guidance.
I'm using
COPY ... USING DELIMITERS '\t','\n','';
to bulk-load tab-delimited unquoted data. The '\t' is the default field separator, the '\n' is the default record separator. The final '' is the quote string -- empty in my case.
See: http://www.monetdb.org/Documentation/Manuals/SQLreference/CopyInto
Cheers, Viktor