The big downside of the csv extension, is that no matter what you do your table ends up with every column with a type of text. A trap if you are you are using union/except/intersect clauses.
On Fri, Mar 8, 2019 at 11:00 AM Keith Medcalf <kmedc...@dessus.com> wrote: > > On Thursday, 7 March, 2019 14:45, Eric Tsau <erict...@gmail.com> asked: > > >Is it possible to add the option of importing data into a temporary > >table? > > >Currently you have to create a temporary table first before importing > >to it, or having to drop the table afterwards. > > >.import dump.csv temp.table > >or > >.import dump.csv attach.table > > Apparently not ;) It would appear that the .import shell command does not > know how to create tables in schema's other than "main" > > However, you can create a virtual table in the temp database using the csv > extension (since .import only works from the sqlite3 shell) ... > > create virtual table temp.tablename using csv(filename=filename.csv, > header=yes); > > The virtual table will be deleted when the connection is closed ... since > it is only a temporary thing. You could then create a duplicate > materialized table if you wished (but since you have a table attached to a > csv file why would you want to do that?) > > --- > 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 > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users