Hello,我是 Alex 007,一个热爱计算机编程和硬件设计的小白,为啥是007呢?因为叫 Alex 的人太多了,再加上每天007的生活,Alex 007就诞生了。
将CSV数据存储到Hive+Python连接Hive
这篇文章呢,我们将已经下载好的新型冠状病毒疫情时间序列的地区数据存储到hive当中。
- 使用hive命令:
hive
- 创建数据库
create database covid_19;
- 进入数据库
use covid_19;
- 创建表
看一眼我们的数据:
CREATE TABLE detail (
continentName string,
continentEnglishName string,
countryName string,
countryEnglishName string,
provinceName string,
provinceEnglishName string,
province_zipCode string,
province_confirmedCount string,
province_suspectedCount string,
province_curedCount string,
province_deadCount string,
updateTime timestamp,
cityName string,
cityEnglishName string,
city_zipCode string,
city_confirmedCount string,
city_suspectedCount string,
city_curedCount string,
city_deadCount string
);
- 导入CSV数据
LOAD DATA LOCAL INPATH '/root/detail.csv' OVERWRITE INTO TABLE detail;