Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Can sqoop create hive database?

Can sqoop create hive database?

New Contributor

Hi Everyone,


Is it possible to create hive database while running sqoop command?


Sample Script:

sqoop import \
--connect "jdbc:sqlserver://hostname:1433;databasename=sqldbname" \
--username asd \
--password "asd123" \
--table tblname \
--hive-import \
--hive-database db_name \
--hive-table  tblname \
--incremental append \
--check-column tablepk \
--split-by tablepk \
-m 2 \
--target-dir /tmp \
-- --schema schname

Error:

Error: Error while compiling statement: FAILED: SemanticException [Error 10072]: Database does not exist: db_name 
3 REPLIES 3

Re: Can sqoop create hive database?

Mentor

@Ali Erdem

This command should work

sqoop import-all-tables --connect "jdbc:sqlserver://hostname:1433;databasename=sqldbname" \
--username asd \
--password "asd123" \
--hive-database db_name \
--hive-import \


Your db_name database should be in the default hive location /user/hive/warehouse


Re: Can sqoop create hive database?

New Contributor

What I understand from your reply is sqoop does NOT create hive database automatically if we don't hive that directory.

Re: Can sqoop create hive database?

Community Manager

The above question as well as the entire reply thread below was originally posted in the Community Help Track. On Tue Jun 4 03:59 UTC 2019, a member of the HCC moderation staff moved it to the Data Processing track. The Community Help Track is intended for questions about using the HCC site itself.

Bill Brooks, Community Manager
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Don't have an account?
Coming from Hortonworks? Activate your account here