So far I haven`t found a solution for the following problem.

I have a number of txt files with tab spaced data.
Each file`s row looks like:
<name> <value0> <value1> ... <valueN-1>
In one file N is the same for all rows, but between files N can have different 
values.
So each row represents an array of real values of length N, and an array name.

I would like to store the data in an sqlite database, using the following 
schema:

create table array
(
    id integer primary key autoincrement,
    name text
);

create table array_value
(
    id integer primary key autoincrement,
    arrayId integer,
    index integer,
    value real,
    foreign key(arrayId) references array(id)
);


What I do now is read the file (outside of sqlite) and use individual insert 
commands for each row of a file.
If I compare the speed of doing this for one file to an import statement in 
sqlite itself there is a big difference, '.import' is much faster
Is there a way to convert table file1 (see below) to the tables array and 
array_value using sqlite commands?
 
create table file1
(
    name text,
    value0 real,
    value1 real,
    value2 real,
.
.
.
    valueN-1 real
);

.mode tabs
.import file1.txt file1


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

Reply via email to