Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

sqoop import from RDBMS to Hive, HBase

avatar
Expert Contributor

Hi everyone, I'm getting data from MySQL and a couple of csv from HDFS to my Hive and HBase services in hadoop. When i perform the script based in the information coming from the official sqoop tool https://sqoop.apache.org/docs/1.4.1-incubating/SqoopUserGuide.html i can't see anything about a parameter to specify the name of a DB in Hive or Hbase to complete the import, all my imports are in default db but i need to specify the name of DB.

Thanks so much for your help guys.

AU

1 ACCEPTED SOLUTION
6 REPLIES 6

avatar

avatar
Expert Contributor

Hi buddy thanks for answer. I went there before came here lol but i couldnt find the answer. thanks

avatar

In the table at the bottom of the page for the first link:

--hive-table <table_name>Specifies the table name to use when importing data into Hive.

So your command would look like

sqoop import --connect jdbc:mysql://db.foo.com/corp --table EMPLOYEES --hive-import --hive-table MYTABLE

avatar
Expert Contributor

Oh yeah buddy by i want to specify the DB in hive for the destination i mean something like --hive-database you get me , cause as default all impoted tables in Hive go to default DB . My requirement is set a different DB to put the data. thanks

avatar

I see. I misread your question. This request was addressed in the below jira:

https://issues.apache.org/jira/browse/SQOOP-912

The flag to specify the database is "--hive-database".

Your command would look like

sqoop import --connect jdbc:mysql://db.foo.com/corp --table EMPLOYEES --hive-import --hive-database MYDATABASE

OR

sqoop import --connect jdbc:mysql://db.foo.com/corp --table EMPLOYEES --hive-import --hive-table MYDATABASE.MYTABLE

avatar
Expert Contributor

Great @Eyad Garelnabi thanks so much that was what I was looking for!!! i will close the question i appreciate.