Joinutility seperatorLogin utility separator Infobright.com
   
 
How to Ignore the wrong row during Data Loading.
Posted: 29 June 2011 11:56 PM   Ignore ]  
Newbie
Rank
Total Posts:  7
Joined  2011-06-28

I have a problem when I loading data into IB.
One row record format is wrong. And it blocked the loading procedure.

The loading command as follows:
mysql —default-character-set=utf8 -ujyl -***  incrementbak -h****  -P 5029 -f -q—execute=“load data local infile ‘D:/docs/bak/ad_site_trace.sql’ replace into table ad_site_trace character set utf8 fields terminated by ‘\\t’ ENCLOSED BY ‘’  “

report an error : Wrong data or column definition. Row : 633823,field:5.

How can I ignore the error , and let the loading forward.

Any suggestion is welcome!
Thanks a lot.

Profile
 
Posted: 30 June 2011 12:01 AM   Ignore ]   [ # 1 ]  
Newbie
Rank
Total Posts:  4
Joined  2011-04-27

You can’t ignore it.
IB will rollback the whole transaction.
You must ensure that all data in file is valid.

Profile
 
Posted: 30 June 2011 12:47 AM   Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  7
Joined  2011-06-28

Thanks for nkucyd’s suggestion

But could you tell me how to ignore when I want to load other datas and only ignore the error rows.

Must I ensure the all data in file is valid?

I use select in file to output the data from mysql.

The error info is
ERROR 2 (HY000) at line 1: Wrong data or column definition. Row: 131789,field:5.

[ Edited: 30 June 2011 12:50 AM by tigerKing]
Profile
 
Posted: 30 June 2011 01:01 AM   Ignore ]   [ # 3 ]  
Newbie
Rank
Total Posts:  7
Joined  2011-06-28

I tried to use mysqlimport ,but still have this problem.

Does someone have the same problems,please share your experience.

Profile
 
Posted: 30 June 2011 03:26 AM   Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  7
Joined  2011-06-28

I have fixed the problem.
If the db record content contains seperators used in export and load command,the loader will misjudge columns of a record.
So I appoint params directly as follows,use escaped char. And it works.

export data:
SELECT *  into outfile ‘D:\\docs\\bak\\ad_site_trace.sql’ fields terminated by ‘,’ ENCLOSED BY ‘\”’ ESCAPED BY ‘\\’ FROM ad_site_trace

load data:
load data local infile ‘D:/docs/bak/ad_site_trace.sql’ replace into table ad_site_trace character set utf8 fields terminated by ‘,’ ENCLOSED BY ‘\”’ ESCAPED BY ‘\\’ ”

Profile
 
Posted: 30 June 2011 10:05 AM   Ignore ]   [ # 5 ]  
Administrator
RankRankRankRank
Total Posts:  448
Joined  2010-09-22

Hi tigerKing,

Glad to hear you fixed the issue.  You posted the same question within forum post http://www.infobright.org/Forums/viewthread/1708/, so I’ll denote in that thread that the issue is fixed here.

Thanks,

Jeff

Signature 

jeff kibler

Profile