SQLite Forum

CSV extension

CSV extension

(1) By anonymous on 2020-07-06 17:21:18 [link] [source]

How can I build this into the standard SQLite distribution automatically to eliminate the need for

.load csv

Thanks in advance...

-- sw

(2.1) By Larry Brasfield (LarryBrasfield) on 2020-07-06 18:38:55 edited from 2.0 in reply to 1 [source]

(Edited to cure recommended usage of nonexistent '-read' invocation option.)

You may be unaware that the SQLite CLI shell, upon startup, will read and interpret a file named .sqliterc if it can be found in the user's home directory. For things you want to make a "sqlite3 ..." invocation always do, that is far simpler than modifying the distribution and rebuilding it.

Similarly easy is to set an alias, resembling alias sqlite3_loaded='sqlite3 -cmd \'.load csv\'' or alias sqlite3_loaded='sqlite3 -cmd \'.read ~/my_special_sqlite_setup\'' That's for the Bash shell; there is probably some way to do it with your favorite shell if you're stuck on Windows. (And good luck if that is cmd.exe!)

If you truly want to do what you asked about, the shell.c distributed with the amalgamation shows how to incorporate extension code into the executable image, without need of any .load operation.

(3) By anonymous on 2020-07-06 18:14:29 in reply to 2.0 [link] [source]

Thank you!

-- sw