Thursday, August 13, 2020

Import Table From Sqoop to Hive Without Data

The below command helps in creating a table in Hive based on the MySQL table’s definition. 

sqoop create-hive-table

--connect=jdbc:mysql://localhost/retail_db

--username=root

--password=cloudera 

--table employees

--hive-table emp;

This will just create the table structure in Hive as "Emp" based on MySQL's Employees table's structure and no data will be imported. 



If you look at the above screens, the data types are converted automatically. The varchar became string and the decimal became "double" in Hive. 

Before implementing, make sure the table "Employees" exists in MySQL retail_db database and the table "Emp" does not exists in Hive. By default, the table will be imported in "default" database in Hive.

No comments:

Post a Comment

Big Data & SQL

Hi Everybody, Please do visit my new blog that has much more information about Big Data and SQL. The site covers big data and almost all the...