SQLite Forum

3 incorrect tables created during import
No that doesn't explain importing into a temporary table, the table doesn't need to be virtual and headers are off.

The docs say: `when the table already exists, every row of the CSV file, including the first row, is assumed to be actual content.`. I've created a temporary table first so the problem is .import can't import into a temporary table, instead creating another "temp.files" table.

In the below example file1 and file2 should be in the temporary files table under column file.

$ sqlite3 
SQLite version 3.34.0 2020-12-01 16:14:00
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .headers off
sqlite> .mode csv
sqlite> .shell echo file1 > import.csv
sqlite> .shell echo file2 >> import.csv
sqlite> create table temp.files(files);
sqlite> .import import.csv temp.files
sqlite> .mode line
sqlite> select * from temp.files; -- this should show file = file1 and file = file2
sqlite> select * from "temp.files"; -- this should not exist
file1 = file2```