sqoop导数

1.import命令

从mysql数据库导入到hive中 itcast_ods.web_chat_ems

mysql   nev.web_chat_ems_2021_09 到hive

代码

sqoop import \
--connect jdbc:mysql://192.168.52.150:3306/nev \
--username root \
--password 123456 \
--query "
select id,
       create_date_time,
       session_id,
       sid,
       create_time,
       seo_source,
       seo_keywords,
       ip,
       area,
       country,
       province,
       city,
       origin_channel,
       user  as user_match,
       manual_time,
       begin_time,
       end_time,
       last_customer_msg_time_stamp,
       last_agent_msg_time_stamp,
       reply_msg_count,
       msg_count,
       browser_name,
       os_info,
       '2021-09-26'   as starts_time
from web_chat_ems_2021_09
where create_time between '2021-09-25 00:00:00' and '2021-09-25 23:59:59' and \$CONDITIONS" \
--hcatalog-database itcast_ods \
--hcatalog-table web_chat_ems \
-m 1

nev.web_chat_text_ems_2021_09 到 itcast_ods.web_chat_text_ems

--因为这个没有条件 要加上 where 1=1
sqoop import \
--connect jdbc:mysql://192.168.52.150:3306/nev \
--username root \
--password 123456 \
--query "
select temp2.*,
       '2021-09-26' as start_time
from
     (select id
      from web_chat_ems_2021_09
      where create_time between '2021-09-25 00:00:00' and '2021-09-25 23:59:59'
     ) temp1
      join web_chat_text_ems_2021_09 temp2
     on temp1.id = temp2.id  where 1=1 and \$CONDITIONS" \
--hcatalog-database itcast_ods \
--hcatalog-table web_chat_text_ems \
-m 1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值