I should have said that "It appears that you are correct, the .import shell 
command does not know how to create a table in other than the default "main" 
schema" and that you are requesting this be changed so that the table being 
imported into does get created in the specified schema if a the table needs to 
be created.

The csv extension is a work-around.  I can see that you might want to 
materialize this table so that you can create indexes on it, or so that the 
query planner can create temporary indexes if they will help speed up a query.  
You could do this (for example) as follows:

create virtual table temp.csvimport using csv(filename=test.csv, header=yes);
create temporary table blahblah as select * from temp.csvimport;
drop table temp.csvimport;

You will have to build the csv extension yourself.  It can be found here:

https://www.sqlite.org/src/artifact/7f047aeb68f5802e

(as file csv.c under ext/misc in the source distribution)

SQLite version 3.28.0 2019-03-05 23:49:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create virtual table temp.csvimport using csv(filename=test.csv, 
header=yes);
sqlite> create temporary table blahblah as select * from temp.csvimport;
sqlite> .tables
temp.blahblah   temp.csvimport
sqlite> drop table temp.csvimport;
sqlite> .mode col
sqlite> .head on
sqlite> select * from blahblah;
a           b
----------  ----------
1           2
2           3
sqlite>

where test.csv contains:

a,b
1,2
2,3

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




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

Reply via email to