
kettle使用文件导入到Postgresql出现如下几种问题的总结:
第一种错误,报错如ERROR: extra data after last expected column所示。或者报错为报错为0x05,多一列,extra data after last expected column。
sql查询语句定位到某个字段:
SELECT * ),'%')
解决方法,使用空替代,原因是出现特殊字符,),这种字符,导致的错误。
解决方法如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
Object[] r = getRow();
if (r == null) {
setOutputDone();
return false;
}
is large
r = createOutputRow(r, data.outputRowMeta.size());
String 字段名称 = get(Fields.In, "字段名称" ).getString(r);
if (字段名称 != null) {
字段名称 = 字段名称.replaceAll(( + "" , "" );
}
get(Fields.Out, "字段名称" ).setValue(r, 字段名称);
putRow(data.outputRowMeta, r);
return true;
}
|
第二种错误,报错如missing data for column "datastamp"。
sql查询语句定位到某个字段:
SELECT * ),'%')
或者
SELECT * ),'%')
解决方法:是字段的值出现了,换行回车,),)。)多一行,少n列,missing data column xxx。解决方法:使用字符替代,然后再替换回来。
解决方法如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
Object[] r = getRow();
if (r == null) {
setOutputDone();
return false;
}
is large
r = createOutputRow(r, data.outputRowMeta.size());
String 字段名称 = get(Fields.In, "字段名称" ).getString(r);
if (字段名称 != null) {
字段名称 = 字段名称.replaceAll( "\\r" , "@#r;" );
字段名称 = 字段名称.replaceAll( "\\n" , "@#n;" );
}
get(Fields.Out, "字段名称" ).setValue(r, 字段名称);
putRow(data.outputRowMeta, r);
return true;
}
|
第三种错误,报错如,0x00的解决方法:
sql查询语句定位到某个字段:
SELECT * ),'%')
解决方法:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
Object[] r = getRow();
if (r == null) {
setOutputDone();
return false;
}
is large
r = createOutputRow(r, data.outputRowMeta.size());
String 字段名称 = get(Fields.In, "字段名称" ).getString(r);
if (字段名称 != null) {
字段名称= 字段名称.replaceAll( "\\u0000" , "" );
}
get(Fields.Out, "字段名称" ).setValue(r, 字段名称);
putRow(data.outputRowMeta, r);
return true;
}
|
Python学习网,大量的免费PostgreSQL入门教程,欢迎在线学习!