表格存储服务 CLOUDTABLE-Broker Load:开始导入

时间:2024-09-20 16:04:25

开始导入

下面我们通过几个实际的场景示例来看Broker Load的使用。

数据样例:

'100','101','102','103','104','105',100.00,100.01,100.02,'100',200,100.08,2022-04-01

'101','102','103','104','105','105',100.00,100.01,100.02,'100',200,100.08,2022-04-02

'102','103','104','105','106','105',100.00,100.01,100.02,'100',200,100.08,2022-04-03

准备工作:

在本地创建示例数据文件source_text.txt,并上传至hdfs的/tmp/。

在hive中创建ods_source表。
CREATE TABLE `ods_source`(
  `id` string, 
  `store_id` string, 
  `company_id` string, 
  `tower_id` string, 
  `commodity_id` string, 
  `commodity_name` string, 
  `commodity_price` double, 
  `member_price` double, 
  `cost_price` double, 
  `unit` string, 
  `quantity` string, 
  `actual_price` double,
  `day ` string
)
row format delimited fields terminated by ','
lines terminated by '\n'
stored as textfile;
将hdfs创建的txt文件导入到ods_source表。
load data inpath '/tmp/source_text.txt' into table ods_source;
support.huaweicloud.com/devg-cloudtable/cloudtable_01_0259.html