I have a large csv file, 88 million rows, 8 GB, originally exported from an Oracle database, that I want to
import into spatialite. I have tried directly through the
spatialite gui, with no success, and also through the use of a virtual table. I have been following the suggestions in the thread post 'Importing csv with GUI changes double to text' to use a create table statement to get the table fields formatted as I wish, and then load from the virtual csv file. This works perfectly with smaller csv files, and I have used it on files with a million rows. The procedure is failing on this large dataset.
Here is a small sample of the data file I am working with, as exported from Oracle:
"IMO","VESSELNAME","VESSELTYPE","DESTINATION","NAVSTATUS","LAT","LON","SOG","AISTIMESTAMP"
"9259604","HALUL 31","96","PS
3_HALUL","0","25.6666833333333","52.4118166666667","0","1243824597906"
"9084516","LISTA","81","SLAGEN","1","59.3276666666667","10.514","0","1243823578843"
"8323094","MV
VERGINA","70","DJIBOUTI","1","11.61265","43.1387833333333","0","1243824482812"
"7812452","SETUBAL","90","SETUBAL","1","38.467","-8.846","0","1243824599000"
"9083172","GSP
LICORN","52","CONSTANTA","0","44.1590333333333","28.64686","0","1243824664203"
"8118554","BIBI-M","0","KUWAIT","0","27.8633766666667","51.0075833333333","17","1243824640062"
"7402477","OCEAN
CLEVER","51","DRAUGEN","0","64.3554","7.79892833333333","0","1243824652718"
"8618059","MED
PRODIGY","79","ORAN","5","35.70935","-0.645566666666667","0","1243824564328"
"9162655","CAROLIEN
SCH81","30","MAURITANIE","0","20.670045","-17.4571633333333","8","1243824440437"
...
...
Here is the syntax for using the virtual table from sql.
CREATE VIRTUAL TABLE vtaisdata USING
VirtualText('aisdata_20131016.csv','CP1252', 1, POINT, DOUBLEQUOTE, ',');
This does create a table vtaisdata, but with only a single field, ROWNO. Creating the virtual table from the spatialite gui gives the same result.
I have tried this with a smaller subset dataset (1000 rows), using a fully qualified path name for the csv file, that works, as does importing the smaller dataset through the gui.
One thought that occurs to me is that there may be some kind of coding error in the 88 million row csv file that is throwing off the process, but I don't know how to verify that.
Any suggestions or thoughts as to how to accomplish loading this dataset into spatialite would be appreciated, including using external means (e.g. a python script).
Thanks in advance
Dick
Result is perfect with 9 rows. Let's see how it will go with your 88 million rows.
-Jukka-