Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a specified Hive database when using Sqoop import

Tags:

hadoop

hive

sqoop

sqoop import --connect jdbc:mysql://remote-ip/db --username xxx --password xxx --table tb --hive-import

The above command imports table tb into the 'default' Hive database.

Can I use other database instead?

like image 514
JustFF Avatar asked Mar 21 '13 10:03

JustFF


3 Answers

Off the top of my head i recall you can specify --hive-table foo.tb

where foo is your hive database and tb is your hive table.

so in your case it would be:

sqoop import --connect jdbc:mysql://remote-ip/db --username xxx --password xxx --table tb --hive-import --hive-table foo.tb

As a footnote, here is the original jira issue https://issues.apache.org/jira/browse/SQOOP-322

like image 111
Mark Vickery Avatar answered Sep 25 '22 05:09

Mark Vickery


Hive database using Sqoop import:

sqoop import --connect jdbc:mysql://localhost/arun --table account --username root --password root -m 1 --hive-import **--hive-database** company **--create-hive-table --hive-table** account --target-dir /tmp/customer/ac

like image 24
Arunpandian Avatar answered Sep 25 '22 05:09

Arunpandian


You can specify the database name as a part of the --hive-table parameter, e.g. "--hive-table foo.tb".

There is a new request to add a special parameter for the database that is being tracked: SQOOP-912.

like image 26
Jarek Jarcec Cecho Avatar answered Sep 26 '22 05:09

Jarek Jarcec Cecho