I get similar results on OS X 10.9.4 if I try to use the version of SQLite 
supplied with the operating system (3.7.13) to import a CSV.

The simple ".mode csv" and ".import <filename> tab1" method works if I run the 
copy of SQLite 3.8.5 I built myself from the source code, or if I use the Mac 
OS X precompiled SQLite 3.8.5 shell from the web site. (I prefer to build my 
own copy because the one on the web site doesn't include the readline library, 
so if used interactively it can't recall previous command lines with up-arrow.)

The problem is likely to be that the method you are using to launch sqlite3, 
which is using the system's default search path to locate sqlite3, and that 
will be the Apple-supplied version (3.7.13) which is located at 
/usr/bin/sqlite3. It appears that version doesn't import CSVs properly.

The easiest way to avoid the problem is to specify the path to your downloaded 
copy of sqlite3.

Assuming you have put the downloaded sqlite3 in your Applications folder, then 
to run it from Terminal you can use this command:

$ /Applications/sqlite3 newDB.db < my_script_file

On 4/09/2014, at 3:24 am, Carlos A. Gorricho (HGSAS) 
<cgorri...@heptagongroup.co> wrote:

> ​When I start sqlite double clicking the icon in the Mac Applications
> folder:
> 
> Last login: Wed Sep  3 10:13:32 on ttys000
> 
> HEPTAGON-GROUP-SAS:~ carlosgorricho$ /Applications/sqlite3 ; exit;
> 
> SQLite version 3.8.5 2014-06-04 14:06:34
> 
> Enter ".help" for usage hints.
> 
> Connected to a *transient in-memory database*.
> 
> Use ".open FILENAME" to reopen on a persistent database.
> 
> sqlite>
> 
> ​
> When starting sqlite on a Terminal Window:
> 
> Last login: Wed Sep  3 10:11:42 on ttys002
> 
> HEPTAGON-GROUP-SAS:~ carlosgorricho$ sqlite3
> 
> SQLite version 3.7.13 2012-07-17 17:46:21
> 
> Enter ".help" for instructions
> 
> Enter SQL statements terminated with a ";"
> 
> sqlite>
> 
> 
> I downloaded the only precompile binary currently available for Mac in
> www.sqlite.org website.
> 
> To perform the job described earlier, I run the Terminal version in batch
> mode. That is, I created a script file with all the .commands to upload de
> CSV file, and ran it on a new database:
> 
> $ sqlite3 newDB.db < my_script_file
> 
> 
> When I got the tab1 error message, I reverted to performing the job from
> inside the database, creating first the table and then uploading the data.
> The result was the huge single-record-field DB I shared earlier.
> 
> I would venture to say I did this from the Terminal sqlite version, but I
> am not certain...
> 
> Thanks in advance for your comments and guidance. Please let me know if I
> can do anything to help you in other fronts.
> 
> 
> 
> 
> Saludos/Cheers,

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

Reply via email to