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