1 ,hive 库操作 :
1 ,查看所有库 : show databases;
2 ,选择一个库 : use lifecycle;
3 ,查看当前库 : select current_database();
4 ,删除 hive 库,并且删除文件 :
drop database if exists balabala cascade;
2 ,表操作 :
1 ,查看库中所有表 : show tables;
2 ,查看表结构 :
describe t_log_java;
3 ,查看建表语句 :
show create table t_log_java;
3 ,建表 1 : 商品信息表
- 规划 :
1 ,分区 : 品牌
2 ,存储格式 : 列式存储
3 ,压缩方式 : snappy
4 ,字段分隔符 : \001
5 ,建表路径 : s3://lifecyclebigdata/01_hive/01_DA_INTO/DA_PDT - sql 语句 :
CREATE TABLE DA_PDT(
PDT_STYLE_COLOR string,
PDT_STYLE string,
PDT_COLOR string,
PDT_YEAR string,
PDT_SEASON string,
PDT_YEAR_SEASON string,
PDT_LIST_MONTH string,
PDT_LIST_TEMP string,
PDT_ORDER_SCORE string,
PDT_OPERATE_SCORE string,
PDT_PRICE string,
PDT_WAVE string,
PDT_SIZE_GROUP string,
PDT_SIZES string,
PDT_DIM1 string,
PDT_DIM2 string,
PDT_DIM3 string,
PDT_DIM4 string,
PDT_DIM5 string,
PDT_DIM6 string,
PDT_DIM7 string,
PDT_DIM8 string,
PDT_DIM9 string,
PDT_DIM10 string,
PDT_DIM11 string)
partitioned by (PDT_BRAND string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
STORED AS parquet
location "s3://lifecyclebigdata/01_hive/01_DA_INTO/DA_PDT"
tblproperties ("parquet.compress"="SNAPPY");
- 成功的标志 : 查询看到表
show tables;
来源:CSDN
作者:孙砚秋
链接:https://blog.csdn.net/qq_34319644/article/details/104040288