How to use a specified Hive database when using Sqoop import

JustFF picture JustFF · Mar 21, 2013 · Viewed 18.9k times · Source
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?

Answer

Mark Vickery picture Mark Vickery · Mar 21, 2013

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