Subject | Re: [firebird-support] Import data from flat files |
---|---|
Author | Aage Johansen |
Post date | 2003-09-30T18:51:14Z |
On Tue, 30 Sep 2003 17:22:02 +0000 (UTC), Oleg Lebedev wrote:
Is the file with separators (|) the only format you can provide?
(Use fixed size fonts to read this!)
If
1|36901|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|blithely ...
2|78002|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0|quickly ...
...
could be transformed into (removing separators, using fixed length fields)
136901O173665.471996-01-025-LOW Clerk#000000951|0|blithely ...
278002O 46929.181996-12-011-URGENTClerk#000000880|0|quickly ...
...
you can use the (very fast) external tables with a table definition like
o_orderkey char(1),
o_custkey char(5),
o_orderstatus char(1),
o_totalprice char(9),
o_orderdate char(10),
o_orderpriority char(8),
o_clerk char (...),
...
(adjusted to your needs).
--
Aage J.
> Well, This seems like a convoluted way to import data from a flat fileUsing a script with INSERT statement surely must be slow!
> into a database.
> What I ended up doing is importing data from a flat file into my
> PostgreSQL database. Then, using postgres pg_dump utility, I exported
> data from the postgres database in a file in a form of INSERT
> statements. Finally, I created my table in my FB database and ran the
> INSERTs script in there.
Is the file with separators (|) the only format you can provide?
(Use fixed size fonts to read this!)
If
1|36901|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|blithely ...
2|78002|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0|quickly ...
...
could be transformed into (removing separators, using fixed length fields)
136901O173665.471996-01-025-LOW Clerk#000000951|0|blithely ...
278002O 46929.181996-12-011-URGENTClerk#000000880|0|quickly ...
...
you can use the (very fast) external tables with a table definition like
o_orderkey char(1),
o_custkey char(5),
o_orderstatus char(1),
o_totalprice char(9),
o_orderdate char(10),
o_orderpriority char(8),
o_clerk char (...),
...
(adjusted to your needs).
--
Aage J.