On Oct 1, 2019, at 12:46 PM, Simon Slavin <slav...@bigfraud.org> wrote:
> 
> 1) export your XLS data in CSV format
> 2) Use the SQLite shell tool to import the CSV data into your database

Beware that SQLite’s CSV import requires that the imported data have the same 
number of columns as the table you’re importing it into.  There is currently no 
way in the SQLite .import shell command to leave some SQLite table columns at 
their default values, so that you can insert “narrower” data into the table.

The main case I have where I run into this is with “id” columns, since you 
can’t then depend on SQLite’s autoincrement behavior.  I’ve always ended up 
generating an “id” column in the input file just to get around this.

I miss MySQL’s LOAD DATA INFILE: it let you give a VALUES clause so you could 
let one or more columns take their default value.  From the docs, it appears 
that PostgreSQL’s COPY…VALUES would also work.  I hope SQLite gets such a 
feature someday.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to