Subject RE: [firebird-support] Import data from flat files
Author Oleg Lebedev
Well, it seems that the lines from my orders.tbl file got wrapped in my
previous posting. The lines in the actual file start with:
1|...
2|...
3|...
4|...
5|...
6|...
7|...
32|...

-----Original Message-----
From: Oleg Lebedev
Sent: Tuesday, September 30, 2003 9:56 AM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Import data from flat files
Importance: Low


Actually, when I said that only 90% or rows were imported, I was basing
this on the count(*) query run against the external table.
I created the external table as follows:

CREATE TABLE Orders
EXTERNAL 'orders.tbl'
(
o_orderkey int NOT NULL ,
o_custkey int NOT NULL ,
o_orderstatus char (1) NOT NULL ,
o_totalprice decimal(18, 0) NOT NULL ,
o_orderdate timestamp NOT NULL ,
o_orderpriority char (15) NOT NULL ,
o_clerk char (15) NOT NULL ,
o_shippriority int NOT NULL ,
o_comment varchar (79) NOT NULL
);

Here are a couple of lines from my orders.tbl file:

1|36901|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|blithely final
dolphins solve-- blithely blithe packages nag blith
2|78002|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0|quickly regular
depend
3|123314|F|193846.25|1993-10-14|5-LOW|Clerk#000000955|0|deposits
alongside of the dependencies are slowly about
4|136777|O|32151.78|1995-10-11|5-LOW|Clerk#000000124|0|final requests
detect slyly across the blithely bold pinto beans. eve
5|44485|F|144659.20|1994-07-30|5-LOW|Clerk#000000925|0|even deposits
cajole furiously. quickly spe
6|55624|F|58749.59|1992-02-21|4-NOT
SPECIFIED|Clerk#000000058|0|ironically bold asymptotes sleep blithely
beyond the regular, clos
7|39136|O|252004.18|1996-01-10|2-HIGH|Clerk#000000470|0|ironic, regular
deposits are. ironic foxes sl
32|130057|O|208660.75|1995-07-16|2-HIGH|Clerk#000000616|0|slyly final
foxes are slyly. packag

I wonder if the problem could be with using bars to separate field
values. So, in any case, the orders.tbl file contains 1,500,000 lines,
but only 90% of them get imported. Do you see anything wrong with what I
am doing here?

Thanks.

-----Original Message-----
From: Milan Babuskov [mailto:albis@...]
Sent: Tuesday, September 30, 2003 9:44 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Import data from flat files
Importance: Low


Oleg Lebedev wrote:
> It worked, thanks.
> I guess it's a new feature, because I wasn't able to find it in the
> Language Reference guide.

Yes, it is.

> Still, I was able to import only about 90% of rows.

Probably some rows couldn't be converted becuse of bad formatting? Have
you tried doing select count(*) from external_table ?

How did you declare your external table? Can you post the DDL here,
please. I suggest that you use only char fields so that you can catch
conversion errors when doing INSERT INTO...

> I tried to enable the write-through cache, but now I can't drop my
> existing table, because it says that object ORDERS is in use. Does it
> always happen when write-through is enabled?

Not really. It sounds more like problem with uncommited transaction.
Before dropping the table always make sure you are the only user
connected, and that you have commited all transactions.

> After I restarted the FB server, ran
>
>>gfix -write sync
>
> and re-imported the data, I was still missing 10% of the rows. Maybe
> my file is messed up, but it worked for other databases.

Please post few lines from your file, and your external table DDL so we
have more detail to help you.

--
Milan Babuskov
http://fbexport.sourceforge.net




To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/

*************************************

This e-mail may contain privileged or confidential material intended for
the named recipient only. If you are not the named recipient, delete
this message and all attachments. Unauthorized reviewing, copying,
printing, disclosing, or otherwise using information in this e-mail is
prohibited. We reserve the right to monitor e-mail sent through our
network.

*************************************


To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/

*************************************

This e-mail may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited.
We reserve the right to monitor e-mail sent through our network.

*************************************