Donald, thanks for your response.

Currently, I'm executing importation by executing a ".reading
filename.ext" command from the SQLite command line. The command file
contains these commands:

______________________________________________________
.separator "    "                            <-- this is a TAB character
.import Categories.txt     Categories
.import ContentFiles.txt   ContentFiles
.import InstallerFiles.txt InstallerFiles
.import ItemCategories.txt ItemCategories
.import Items.txt          Items
.import RelatedItems.txt   RelatedItems
.import RequiredItems.txt  RequiredItems
______________________________________________________

This works correctly. I am seeking to automate this process via software.
I was hoping there was something that had been implemented to replace the
COPY() API call. 

If not, I will write a program to read the flat files one record at a time
and INSERT each record into our database.

Best regards,

Lee Crain

__________________________



-----Original Message-----
From: Griggs, Donald [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 31, 2007 3:35 PM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] A Data Importation Question

Hi Lee,


If I answer wrongly here, I trust (and hope) someone will correct me:

Regarding: "I need a way to programmatically import data from flat
files..."

Sqlite itself is designed to be small and simple -- for some embedded
uses even the sql parser is removed.  I don't think there's an api call
for such imports.

However, the full source of the command line software is available as a
model.

FWIW, I import files using batch files quite often.  Note that the
.import command requies the target table name.
If you try it, you will want to preface the .import with a command of
   .separator '\t'
since the default is a virgule ('|').

BTW, I don't think the .import can tolerate separator characters within
a field -- and surrounding a field with quotes will only cause the
quotes to be imported as well.  Since you're using a tab as separator
you probably won't have that issue, but with comma-separated files, it
can be a problem.



 

--------------------------------------------------------------------------
---
To unsubscribe, send email to [EMAIL PROTECTED]
--------------------------------------------------------------------------
---



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to