Closed Malaban closed 4 years ago
比较好的方式是使用odps-sdk的tunnel读取odps 数据,之后通过mysql jdbc写入mysql
odps-sdk tunnel的example:
TableTunnel tunnel = new TableTunnel(odps);
try {
DownloadSession downloadSession = tunnel.createDownloadSession(project, table);
System.out.println("Session Status is : "+ downloadSession.getStatus().toString());
long count = downloadSession.getRecordCount();
System.out.println("RecordCount is: " + count);
RecordReader recordReader = downloadSession.openRecordReader(0, count);
Record record;
while ((record = recordReader.read()) != null) {
consumeRecord(record, downloadSession.getSchema());
}
recordReader.close();
} catch (TunnelException e) {
e.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
A clear and concise description of what the problem is.