zoukankan      html  css  js  c++  java
  • sqoop:mysql to hdfs

    将mysql联合查询的结果导入到hdfs上

    sqoop import --connect jdbc:mysql://ip/数据库 --username root --password 密码 --query "select p.bidNo as bidNo,p.interestTime as interestTime,p.status as status,p.planStatus as planStatus,
    i.yield as yield,
    i.startDate as startDate,
    i.endDate as endDate,
    i.cycle as cycle,
    i.financedAmount as financedAmount,
    e.interestType as interestType,
    a.penaltyAmount as penaltyAmount,
    (
    case
    when
    (select count(1) from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1) > 0
    then (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime((select pp.interestTime from zx_standard_plan pp where pp.interestTime < p.interestTime and pp.bidNo = p.bidNo order by pp.interestTime desc limit 1)))))
    else (select TO_DAYS(date(from_unixtime(p.interestTime)))-TO_DAYS(date(from_unixtime(i.startDate))))
    end) as days
    from
    zx_standard_plan p
    left join zx_standard_informations i
    on p.bidNo = i.bidNo
    left join zx_standard_extra e
    on e.bidNo = p.bidNo
    left join zx_advance_repay a
    on a.bidNo = p.bidNo
    where
    p.planStatus <> 'VOID' and
    i.bidType <> 'GREEN' and
    i.bidStatus <> 'FINISHED' and
    $CONDITIONS
    order by p.interestTime asc" -m 1 --target-dir /zhongxin/standardPlanStatistics
    

      

  • 相关阅读:
    pycharm设置linux中的python解析器进行本地开发
    linux安装python
    Jenkins自动构建的几种方式
    接口加密
    python接口自动化—unittest 常用的断言方法
    cookie 组成结构
    post请求的四种数据格式
    jmeter之数据库相关
    jmeter函数简介
    java_第一年_JDBC(6)
  • 原文地址:https://www.cnblogs.com/Smilence1024/p/7999391.html
Copyright © 2011-2022 走看看