sh cca175-problem-5-step-7-validation.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh cca175-problem-5-step-7-validation.sh相关的知识,希望对你有一定的参考价值。

// On Hive Window

use problem5;

insert into table products_hive 
  values (1380,4,'something 1380','something 2',8.00,'not avaialble',3,'NOT APPLICABLE');
insert into table products_hive 
  values (1381,4,'something 1380','something 2',8.00,'not avaialble',3,'NOT APPLICABLE');

// On MYSQL window
create table products_external (
  product_id int(11) primary Key, 
  product_grade int(11), 
  product_category_id int(11), 
  product_name varchar(100), 
  product_description varchar(100), 
  product_price float, 
  product_impage varchar(500), 
  product_sentiment varchar(100)
);

// On Terminal 

sqoop export \
  --username "retail_dba" \
  --password "cloudera" \
  --connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
  --export-dir /user/hive/warehouse/problem5.db/products_hive/ \
  --fields-terminated-by '\001' \
  --input-null-non-string "null" \
  --input-null-string "null" \
  --update-mode allowinsert \
  --update-key product_id \
  --columns "product_id,product_category_id,product_name,product_description,product_price,product_impage,product_grade,product_sentiment" \
  --table products_external;

// On Hive Window 

insert into table products_hive 
  values (1382,4,'something 1380','something 2',8.00,'not avaialble',3,'NOT APPLICABLE');
insert into table products_hive 
  values (1383,4,'something 1380','something 2',8.00,'not avaialble',3,'NOT APPLICABLE');

// On Terminal Window:

sqoop export \
  --username "retail_dba" \
  --password "cloudera" \
  --connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
  --export-dir /user/hive/warehouse/problem5.db/products_hive/ \
  --fields-terminated-by '\001' \
  --input-null-non-string "null" \
  --input-null-string "null" \
  --update-mode allowinsert \
  --update-key product_id \
  --columns "product_id,product_category_id,product_name,product_description,product_price,product_impage,product_grade,product_sentiment" \
  --table products_external;

// To Validate
//  On Hive
select count(*) from problem5.products_hive;
// on MySQL
select count(*) from products_replica;

以上是关于sh cca175-problem-5-step-7-validation.sh的主要内容,如果未能解决你的问题,请参考以下文章

sh cca175-problem-5-step-1-sqoop-import.sh

sh cca175-problem-5-step-2-sqoop-import.sh

sh cca175-problem-5-step-3-sqoop-import.sh

sh cca175-problem-5-step-4-sqoop-merge.sh

sh cca175-problem-5-step-6-sqoop-import.sh

sh cca175-problem-03-partitioning.sh