Sqoop export failure - creating table


#1

team, I am running below command to create a table in retail_export schema in mysql and seeing a failure.

sqoop export --connect jdbc:mysql://nn01.itversity.com:3306/retail_export --username retail_dba --password itversity --query “create table departments_sri as select * from retail_db.departments where 1=2”;

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.
18/05/08 18:16:51 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6.2.5.0.0-1245
18/05/08 18:16:51 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/05/08 18:16:51 ERROR tool.BaseSqoopTool: Error parsing arguments for export:
18/05/08 18:16:51 ERROR tool.BaseSqoopTool: Unrecognized argument: --query
18/05/08 18:16:51 ERROR tool.BaseSqoopTool: Unrecognized argument: create table departments_sri as select * from retail_db.departments where 1=2


#2

@sbhupathiraju Try with sqoop eval command.
for e.g:

   sqoop eval \
    --connect jdbc:mysql://nn01.itversity.com:3306/retail_export \
    --username retail_dba \
    --password itversity \
    --query "create table departments_annu as select * from retail_db.departments where 1=1"

while exporting a table in sqoop we will not use query.
For more information, you can go to this link http://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html#_using_generic_and_specific_arguments