#!/bin/bash
hive -e "
drop table if exists dim.media_video
"
sqoop create-hive-table --connect jdbc:mysql://hadoop103:3306/autopai-content --username root --password 000000 --table wt_media_video --hive-table dim.wt_media_video --fields-terminated-by ,
首先可以先删除原來的表格:
drop table if exists dim.media_video
然後利用sqoop再去根據mysql中對應的表的結構重新盡力一張表。
sqoop create-hive-table --connect jdbc:mysql://hadoop103:3306/autopai-content --username root --password 000000 --table wt_media_video --hive-table dim.wt_media_video --fields-terminated-by ,
這個一定要加最後一個參數,“--fields-terminated-by ,” ,尤其是逗号,否則會報錯。筆者也不太清楚是為什麼。