csv文件导入hive

1.启动集群hdfs和yarn

2.进入jdbc

hive --service metastore

bin/hive --service hiveserver2

bin/beeline -u jdbc:hive2://node01:10000 -n hadoop

3.将csv文件粘到相应的目录下,随即在hive中建表

create table lingshou_csv (ID String,
                         name String,
                         tongxunaddress String,
                         zhuceaddress String,
                         faren String,
                         xingzhengcode String,
                         hangyeweidu String,
                         hangyecode String,
                         hangyedalei String,
                          hangye2 String,
                         hangyecode1 String,
                         dengjizhuce String,
                          jishulingyu String,
                         qiyeweidu String,
                         gaoxinjishuweidu String,
                         gaoxin String,
                         gaoxindalei String,
                         gongyeall String,
                         yingyeshouru String,
                         nianmoall String,
                         yearall String,
                         congyerenyuan String,
                         zhuanyejishu String,
                         kejihuodongrenyuan String,
                         kejihuodongjingfei String,
                         zhuanlishenqingnum String,
                         zhuanlishouquan String,
                         diyuweidu String,
                         datayear String)
                         ROW format delimited fields terminated by ',' STORED AS TEXTFILE;

4.将csv文件导入:load data local inpath '/kkb/install/hive/AA.csv' into table AA01;

导入成功

posted @ 2021-09-29 22:55  天岁  阅读(1039)  评论(0编辑  收藏  举报