hive dml/ddl/dataType

hive ddl :

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-DropTable

hive dml :

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingvaluesintotablesfromSQL

 

Hive Data Types:

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types

 

/*
create table db_working.t_students (
  id        int comment 'id',
  name      string comment '姓名',
  age       int comment '年龄',
  sex       int comment '性别'
) 
comment '学生表'
partitioned by (dt string) 



SELECT *FROM t_students ;


SET mapreduce.job.queuename=root.users.bzbd_batch

INSERT INTO TABLE db_working.t_students PARTITION (dt='2021-01-03')   VALUES (1,'fred flintstone', 35, 1), (2,'barney rubble', 32, 0);
INSERT OVERWRITE TABLE db_working.t_students PARTITION (dt='2021-01-04')   VALUES (2,'fred flintstone', 35, 1), (3,'barney rubble', 32, 0);

truncate table  db_working.t_students PARTITION (dt='2021-01-03');
DROP TABLE IF EXISTS  db_working.t_students ;

**/

  

sqoop import \
--D mapreduce.job.queuename=root.users.xxxx \
--connect jdbc:mysql://localhost:3306/test \
--username _uat_tableName \
--password "M4IJLvTC#N" \
--table t03_shop_gmvrevslp_version \
--create-hive-table \
--hive-database db_working \
--hive-import \
--hive-overwrite \
--hive-table hive_tableName \
--mapreduce-job-name FromMySQL2hive \
--delete-target-dir \
--fields-terminated-by '\t' \
-m 1 \
--hive-partition-key dt \
--hive-partition-value "2021-01-04"

  

 

posted @ 2022-01-05 18:49  linbo.yang  阅读(41)  评论(0编辑  收藏  举报