Advertisement
Guest User

Untitled

a guest
Mar 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. mysql> show create table employees;
  2. +-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. | Table | Create Table |
  4. +-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. | employees | CREATE TABLE `employees` (
  6. `emp_no` int(11) NOT NULL,
  7. `birth_date` date NOT NULL,
  8. `first_name` varchar(14) NOT NULL,
  9. `last_name` varchar(16) NOT NULL,
  10. `gender` enum('M','F') NOT NULL,
  11. `hire_date` date NOT NULL,
  12. PRIMARY KEY (`emp_no`)
  13. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
  14. +-----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. 1 row in set (0,00 sec)
  16.  
  17. sqoop import --connect jdbc:mysql://localhost/employees --username root --password password --table employees --hive-import --create-hive-table --hive-table employees
  18.  
  19. hive> show create table employees;
  20. OK
  21. CREATE TABLE `employees`(
  22. `emp_no` int,
  23. `birth_date` string,
  24. `first_name` string,
  25. `last_name` string,
  26. `gender` string,
  27. `hire_date` string)
  28. COMMENT 'Imported by sqoop on 2019/03/18 00:24:11'
  29. ROW FORMAT SERDE
  30. 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
  31. WITH SERDEPROPERTIES (
  32. 'field.delim'='',
  33. 'line.delim'='n',
  34. 'serialization.format'='')
  35. STORED AS INPUTFORMAT
  36. 'org.apache.hadoop.mapred.TextInputFormat'
  37. OUTPUTFORMAT
  38. 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
  39. LOCATION
  40. 'hdfs://localhost:9000/user/hive/warehouse/employees'
  41. TBLPROPERTIES (
  42. 'transient_lastDdlTime'='1552865076')
  43. Time taken: 1.304 seconds, Fetched: 22 row(s)
  44.  
  45. hive> insert into employees values (10001, "1986-04-17", "Hichem",
  46. "BOUSSETTA", "M", "2014-09-91");
  47. Moving data to directory hdfs://localhost:9000/user/hive/warehouse/employees/.hive-staging_hive_2019-03-18_00-32-16_851_8569619447966100947-1/-ext-10000
  48. Loading data to table default.employees
  49. MapReduce Jobs Launched:
  50. Stage-Stage-1: Map: 1 Cumulative CPU: 5.79 sec HDFS Read: 5080 HDFS Write: 120 SUCCESS
  51. Total MapReduce CPU Time Spent: 5 seconds 790 msec
  52. OK
  53. Time taken: 42.422 seconds
  54. hive> select * from employees;
  55. OK
  56. 10001 1986-04-17 Hichem BOUSSETTA M 2014-09-91
  57. 10001 1953-09-02 Georgi Facello M 1986-06-26
  58. 10002 1964-06-02 Bezalel Simmel F 1985-11-21
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement