Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement