You need to handle the load yourself.  Since you are talking bulk load, a
scripting language is probably out of the question because they are too
slow.  I used C# with the System.Data.Sqlite binary.

The db handling you need to worry about is the following:

connection to db
prepare an insert statement
read your input
while not eof
  populate prepared insert arguments
  execute the insert
  read your input
end
close connection

It's about that simple.  Depending on how many millions your are loading,
you might want to setup a transaction cycle and commit every so often.  I
think I committed every 1mm records.  It is a very fast load.

With what I was doing at the time, I started using Ruby because it was
quick to implement (less than 5 minutes).  But the execution time of the
load was going to be 24hrs or in that range.  Using a compiled language
(C#) the load happened in about 15 minutes (~750m a minute).  So the time
it took to write in C# was worth it.

If this is one time load, I have used small sqlite managers to do the bulk
load (Sqlite Expert to be exact.)  The bulk load is very fast.  But you
must go through the interactive wizard every time to do a load.  You cannot
save the setup and repeat the action from the command line, unfortunately.

dvn

On Mon, Mar 28, 2016 at 2:45 AM, Simon Slavin <slavins at bigfraud.org> wrote:

>
> On 28 Mar 2016, at 6:49am, Mahi Gurram <mahigurram4u at gmail.com> wrote:
>
> > I have tried .import and its working for command line interface. But i
> need
> > to do a bulk import (copy data from file into table) from c interface.
>
> Sorry, but SQLite has no facilities for handling text files.  It reads and
> writes to its own database files only.  You will have to write your own
> routines to read text from your text files.
>
> You might instead like to use system calls to script the command line
> shell:
>
> https://www.sqlite.org/cli.html
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to