Re: [sqlite] Importing table

2008-06-17 Thread Jim Dodgen
don't forget to wrap inserts in begin; commit; pairs


On 6/17/08, Dennis Cote <[EMAIL PROTECTED]> wrote:
> Alberto Simões wrote:
> >
> > I have a text file with 18 399 392 lines. Each line contains five
> > fields. Four are a compound key, the other is just  data.
> > What is the best way to import this to sqlite?
> >
> > I am thinking on creating another text file with  18 399 392  INSERT 
> > commands.
> > Would that be the best method?
> >
>
> You might be able to do it more directly using the .import command. It
> can read a fixed number of columns separated by fixed delimiters. It
> works with CSV files for example.
>
> All data are inserted as strings, but the strings may be converted to
> integer or real values if the columns have suitable affinity (see
> http://www.sqlite.org/datatype3.html for more details).
>
> HTH
> Dennis Cote
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Jim Dodgen
[EMAIL PROTECTED]
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Importing table

2008-06-17 Thread Dennis Cote
Alberto Simões wrote:
> 
> I have a text file with 18 399 392 lines. Each line contains five
> fields. Four are a compound key, the other is just  data.
> What is the best way to import this to sqlite?
> 
> I am thinking on creating another text file with  18 399 392  INSERT commands.
> Would that be the best method?
> 

You might be able to do it more directly using the .import command. It 
can read a fixed number of columns separated by fixed delimiters. It 
works with CSV files for example.

All data are inserted as strings, but the strings may be converted to 
integer or real values if the columns have suitable affinity (see 
http://www.sqlite.org/datatype3.html for more details).

HTH
Dennis Cote


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


Re: [sqlite] Importing table

2008-06-17 Thread Alberto Simões
On Tue, Jun 17, 2008 at 6:33 PM, P Kishor <[EMAIL PROTECTED]> wrote:
> On 6/17/08, Alberto Simões <[EMAIL PROTECTED]> wrote:
>> Hi, Folks
>>  I am thinking on creating another text file with  18 399 392  INSERT 
>> commands.
>>  Would that be the best method?
>
> Look at the .read command in the sqlite3 command line program.
>

OK, then INSERTs is the way.
Thanks

-- 
Alberto Simões
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Importing table

2008-06-17 Thread P Kishor
On 6/17/08, Alberto Simões <[EMAIL PROTECTED]> wrote:
> Hi, Folks
>
>  I have a text file with 18 399 392 lines. Each line contains five
>  fields. Four are a compound key, the other is just  data.
>  What is the best way to import this to sqlite?
>
>  I am thinking on creating another text file with  18 399 392  INSERT 
> commands.
>  Would that be the best method?

Look at the .read command in the sqlite3 command line program.

>
>  (by the way, I am expecting to have bigger tables in the near future)
>
>  Thanks
>  Alberto
>
>
>  --
>  Alberto Simões
>  ___
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Importing table

2008-06-17 Thread Alberto Simões
Hi, Folks

I have a text file with 18 399 392 lines. Each line contains five
fields. Four are a compound key, the other is just  data.
What is the best way to import this to sqlite?

I am thinking on creating another text file with  18 399 392  INSERT commands.
Would that be the best method?

(by the way, I am expecting to have bigger tables in the near future)

Thanks
Alberto

-- 
Alberto Simões
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users