multiple dbf files

123 views
Skip to first unread message

Mike Koltsov

unread,
Mar 18, 2016, 12:01:14 PM3/18/16
to PgDBF
Hi!

Is there a way to generate output from multiple dbf files (e.g. when a table is split into a hundred of DBFs).
Or, alternatively, is there a way to pass a table name parameter to pgdbf?

Many thanks,
Mike.

Philipp Wollermann

unread,
Mar 19, 2016, 4:11:00 AM3/19/16
to Mike Koltsov, PgDBF
Hi Mike,

I don't think so, but it shouldn't be too hard to add support for this. We can add a command-line parameter for the table name and use that instead of extracting it from the filename.

If you feel comfortable working with the code, feel free to give it a try and send a pull request. I can also have a look, I could probably get it done by Monday. It really should only be a ~10 line patch or so.

You could also try to use sed to post-process pgdbf's output, as the table name is not used in many places - if you use the flags: -CDt (don't CREATE TABLE, don't DROP TABLE, use a transaction), then the table name will only be used in the second line of the output (the first line will be 'BEGIN;' to start the transaction). You could replace that like this (where 'mytablename' is the table name you want to use):

for dbf in *.dbf; do
  pgdbf -CDt $dbf | sed '2c\\\COPY mytablename FROM STDIN'
done

I haven't tested this, but I think it should work.

Hope that helps,
Philipp

--
You received this message because you are subscribed to the Google Groups "PgDBF" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgdbf+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages