File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,36 @@ LOCATION '/apps/hive/warehouse/cards.db/deck_of_cards';
26
26
-- CREATE DATABASE retail_edw;
27
27
-- CREATE DATABASE retail_stage;
28
28
29
+ -- HDPCD - Define a Hive-managed table
30
+ USE retail_stage;
31
+ CREATE TABLE orders_demo (
32
+ order_id int,
33
+ order_date string,
34
+ order_customer_id int,
35
+ order_status string
36
+ )
37
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
38
+ STORED AS TEXTFILE;
39
+
40
+ -- HDPCD - Define a Hive external table
41
+ -- Download the data from github, unzip and copy deckofcards.txt
42
+ -- Run on terminal on your PC/Mac to copy data to sandbox
43
+ -- scp ./Documents/Training/GoogleDrive/Training/data/cards/deckofcards.txt root@sandbox.hortonworks.com:~
44
+ -- On sandbox
45
+ hadoop fs -mkdir /user/root/cards
46
+ hadoop fs -put deckofcards.txt /user/root/cards
47
+ hadoop fs -ls /user/root/cards
48
+ -- launch hive by running "hive"
49
+ CREATE DATABASE IF NOT EXISTS cards;
50
+ USE cards;
51
+ CREATE EXTERNAL TABLE deck_of_cards_external
52
+ (color string,
53
+ suit string,
54
+ pip string)
55
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
56
+ LOCATION '/user/root/cards';
57
+
58
+
29
59
-- Create ods tables (mostly they will follow same structure, except additional audit columns)
30
60
use retail_ods;
31
61
CREATE TABLE categories (
You can’t perform that action at this time.
0 commit comments