Richard:

Is this injection part of an ongoing process or just a one-time import 
of data?

If you're only going to do this once then you might want to try 
importing the data by using a spreadsheet to construct the necessary SQL 
INSERT statements.  It will load slower than your program would load 
them but depending on the amount data it's tolerable.


Here's what I do...

Copy the data into a spreadsheet.

Re-order and/or duplicated the columns of data as necessary for the next 
step

Insert empty columns and place SQL fragments in these new columns

You can create multiple inserts on the same line (for multiple tables 
for example) by separating them with a semi-colon and duplicating 
columns of data as required.

When the syntax is correct then export it as a delimited file (for 
example, delimited by a pipe character: |  ). 

Use an programmable editor (like VIM, JEdit, bbedit, etc.) to remove all 
the pipe characters and the resulting file can be executed from the 
command line. 
   (in VIM I just enter the following command to remove the delimiters 
all at once):
     :%s/|//g


You can also insert several sample rows in the tables and then dump them 
them and modify the dump file to contain your entire data set.   I 
believe that data is tab-delimited.



Hope this helps,

Eric

beamends wrote:
> Hi All,
> not strictly a LSMB thing, but as the answer may be of interest to
> others here goes... (excuse the terminology, I'm not of the dbase expert
> persuasion)
>
>
> I'm "injecting" data into Postgres using a C program via libpq. From the
> documentation it's not clear if the various functions check/wait to see
> if a dbase command has been or can be completed before returning from
> the function ("locking"?). All is tickety-boo except when creating a new
> part. When the new part is created the next line is to create the
> partsvendor table entry. This works ok for most of the time, but will
> start failing after a while with the INSERT into partsvendor failing.
> Doing the command from the SQL window in phppgadmin will then work.
> Presumably this is a timing issue or such. So the question is, is there
> and SQL or Posgres command to interrogate the dbase to see if it is
> "ready" for the next command. Or am I barking up the wrong tree
> entirely! 
>
> Cheers
> Richard   
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ledger-smb-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ledger-smb-users
>   

-- 
#  Eric Lucas              | Email:   [email protected]
#  Lucii.com               | Website: www.lucii.com
#  PO Box 5301             | Phone:   610-541-0774 or 484-889-3240
#  Springfield Pa. 19064   | Mobile:  610-715-6881


------------------------------------------------------------------------------
_______________________________________________
Ledger-smb-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-users

Reply via email to