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.

-- --schema doesn't work with Sqoop create-hive-table

-- --schema doesn't work with Sqoop create-hive-table

Expert Contributor

HDP-2.5.0.0 using Ambari 2.4.0.1

I'm able to create a table in HCatalog from a SQL Server source db, for example :

sqoop import --null-string '\\N' --null-non-string '\\N' --hive-delims-replacement '\0D' --hcatalog-home /usr/hdp/current/hive-webhcat --hcatalog-database MS_Management_Coaching --hcatalog-table TripAggregate --create-hcatalog-table --hcatalog-storage-stanza 'stored as orc tblproperties ("orc.compress"="ZLIB")' --validate --connect 'jdbc:sqlserver://<DB server>;database=Management' --username uname--password pwd--table TripAggregate -- --schema Coaching

but when I try to use a the --create-hive-table, the -- --schema option doesn't work, no matter where I position it :

-bash-4.2$ sqoop create-hive-table --hive-database test --connect 'jdbc:sqlserver://<DB Server>;database=Management' --username uname--password pwd--table TripAggregate -- --schema Coaching
Warning: /usr/hdp/2.5.0.0-1245/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
16/10/12 21:28:13 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.0.0-1245
16/10/12 21:28:13 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
16/10/12 21:28:13 ERROR tool.BaseSqoopTool: Error parsing arguments for create-hive-table:
16/10/12 21:28:13 ERROR tool.BaseSqoopTool: Unrecognized argument: --
16/10/12 21:28:13 ERROR tool.BaseSqoopTool: Unrecognized argument: --schema
16/10/12 21:28:13 ERROR tool.BaseSqoopTool: Unrecognized argument: DriverCoaching
Try --help for usage instructions.
6 REPLIES 6

Re: -- --schema doesn't work with Sqoop create-hive-table

@Kaliyug Antagonist

The --schema option may only be available when you use the sqoop import command. The sqoop create-hive-table command may not support the --schema option. Have you tried placing -- --schema as the first option after sqoop create-hive-table?

Re: -- --schema doesn't work with Sqoop create-hive-table

Expert Contributor

Yeah, I tried placing it immediately after the create-hive-table, in vain.

Is there any way to get this working ?

Highlighted

Re: -- --schema doesn't work with Sqoop create-hive-table

New Contributor

You can use --hcatalog-database. Your import statement should look like

sqoop import --connect jdbc:oracle:thin:@<db_details> --username dummy --password dummy --table t1 --hcatalog-database db_name --create-hcatalog-table --hcatalog-table test_am2 --hcatalog-storage-stanza 'stored as orc tblproperties ("orc.compress"="SNAPPY")'

Re: -- --schema doesn't work with Sqoop create-hive-table

Expert Contributor

Well, this command will import the data as well, I have this working already(please refer the original question). I'm stuck at the fact that I need to just create an empty table.

Re: -- --schema doesn't work with Sqoop create-hive-table

Re: -- --schema doesn't work with Sqoop create-hive-table

Expert Contributor

The said link doesn't address the problem of connecting to the source schema (-- --schema) but talks about creation of Hive schema