(following description simplified)

I have a text file I wanted to .import into a table.  The text file has two 
columns separated by a tab: a word and a number.  It starts off like this:

!       32874624
"       239874242
#       98235252
$       438743824
%       324872489
&       39854724
a       23498725
i       1298371287
as      23194874
at      3598725

and continues for another 13588392 (sic.) rows.

I use the SQLite shell tool.  I create an appropriate table in my database, set 
.separator to "\t" and use .import.

The .import failed because the second line of the file contains a quote 
character.  I'm okay with the fact that it fails: it's documented, or nearly 
documented.

However, the failure message is this:

Error: mytextfile.txt line 13588392: expected 2 columns of data but found 1

Naturally I spent some time looking near the end of the file to figure out what 
was wrong where the actual error was in line 2, and should have read something 
like "still inside quote when file ends".

It would be useful if this was explicitly checked for when .import reached the 
end of the file.  An alternative would be for the .import command to include 
text telling you how many records were successfully understood before the error 
occurred.  For my error this would have generated a message like the following:

Error: mytextfile.txt line 13588392: after successfully reading 1 record, 
expected 2 columns of data but found 1

This would also have told me where to look for the problem in the file.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to