-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqoop.sql
More file actions
61 lines (50 loc) · 1.58 KB
/
sqoop.sql
File metadata and controls
61 lines (50 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CREATE DATABASE lgarswood;
USE lgarswood;
CREATE TABLE top_categories (
id INT NOT NULL AUTO_INCREMENT,
category VARCHAR(20),
PRIMARY KEY(id));
CREATE TABLE top_products (
id INT NOT NULL AUTO_INCREMENT,
category VARCHAR(20),
product VARCHAR(30),
PRIMARY KEY(id));
CREATE TABLE top_countries (
id INT NOT NULL AUTO_INCREMENT,
country_name VARCHAR(20),
spending DECIMAL(10, 2),
PRIMARY KEY(id));
----------- SPARK EQUIVALENTS ------------------
CREATE TABLE top_categories_spark (
id INT NOT NULL AUTO_INCREMENT,
category VARCHAR(20),
PRIMARY KEY(id));
CREATE TABLE top_products_spark (
id INT NOT NULL AUTO_INCREMENT,
category VARCHAR(20),
product VARCHAR(30),
PRIMARY KEY(id));
CREATE TABLE top_countries_spark (
id INT NOT NULL AUTO_INCREMENT,
country_name VARCHAR(20),
spending DECIMAL(10, 2),
PRIMARY KEY(id));
-------------------------------------------------------
sqoop export \
--connect jdbc:mysql://10.0.0.21/lgarswood \
--table top_categories \
--export-dir /user/hive/warehouse/lg_top_categories \
--columns category \
--input-fields-terminated-by ','
sqoop export \
--connect jdbc:mysql://10.0.0.21/lgarswood \
--table top_products \
--export-dir /user/hive/warehouse/lg_top_products \
--columns category,product \
--input-fields-terminated-by ','
sqoop export \
--connect jdbc:mysql://10.0.0.21/lgarswood \
--table top_countries \
--export-dir /user/hive/warehouse/lg_top_countries \
--columns country_name,spending \
--input-fields-terminated-by ','