kettle 迁移数据

导航

转换

kettle 迁移数据_第1张图片

kettle 迁移数据_第2张图片

作业
kettle 迁移数据_第3张图片

笔者当时做的数据量还是比较大的,所以当时参考网上的文章,做了分页的操作;
分页
kettle 迁移数据_第4张图片

var totalCount = parseInt(parent_job.getVariable("TOTAL_COUNT"));

var pageSize = parseInt(parent_job.getVariable("PAGE_SIZE"));

var totalPage = parent_job.getVariable("TATAL_PAGE");

var currPage = parent_job.getVariable("CURR_PAGE");

if( totalPage == null || totalPage == undefined || totalPage == "") 
{
    totalPage = totalCount / pageSize;
    if (totalCount % pageSize > 0) ++totalPage;// 如果有1001条,每页100条的话,应该分为1001/100 + 1页
    parent_job.setVariable("TOTAL_PAGE",totalPage);
} 
else 
{
    totalPage = parseInt(totalPage);
}


if( currPage == null || currPage == undefined || currPage == "") 
{
    currPage = 1;
} 
else 
{
    currPage = parseInt(currPage);
}

if (currPage > totalPage )
{
    false; 
}
else 
{
    var start = (currPage - 1) * pageSize;
    parent_job.setVariable("START_ROW",start);
    parent_job.setVariable("CURR_PAGE",currPage + 1);

    true;
} 

你可能感兴趣的:(kettle 迁移数据)