Sqoop export using columns control parameter

sqoop

#1

Not able to execute export command with columns control parameter in cloudera QuickStart VM

hive> use sqoop_import;
OK
Time taken: 2.608 seconds
hive> desc daily_revenue
> ;
OK
order_date string
revenue float
Time taken: 4.932 seconds, Fetched: 2 row(s)
hive> select * from daily_revenue limit 2;
OK
2013-07-25 00:00:00.0 68153.83
2013-07-26 00:00:00.0 136520.17
Time taken: 8.771 seconds, Fetched: 2 row(s)

mysql> desc daily_revenue_demo;
±-------------±-------------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±-------------±-------------±-----±----±--------±------+
| revenue_demo | float | YES | | NULL | |
| order_date | varchar(30) | YES | | NULL | |
| description | varchar(200) | YES | | NULL | |
±-------------±-------------±-----±----±--------±------+
3 rows in set (0.02 sec)

mysql> select * from daily_revenue_demo;
Empty set (0.00 sec)

mysql> \q
Bye

[cloudera@quickstart ~]$ sqoop export --connect jdbc:mysql://localhost/retail_export --username root --password cloudera --table daily_revenue_demo --columns order_date, revenue_demo --export-dir /user/hive/warehouse/sqoop_import.db/daily_revenue --input-fields-terminated-by “\001”–num-mappers 1

Warning: /usr/lib/sqoop/…/accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
18/03/25 12:23:48 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.12.0
18/03/25 12:23:48 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Error parsing arguments for export:
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: revenue_demo
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: --export-dir
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: /user/hive/warehouse/sqoop_import.db/daily_revenue
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: --input-fields-terminated-by
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: \001–num-mappers
18/03/25 12:23:48 ERROR tool.BaseSqoopTool: Unrecognized argument: 1

could you please help me in getting this issue resolved.

Thanks in advance


#2

The problem seems to be there:

Maybe you should put space between the two and – before num-mappers


#3

May be you have give single quotes instead of double quotes in input field terminated by.


#4

Thank you for your consideration. I tried after giving space between the two - and and even after removeing --num-mappers, but it didn’t worked for me.


#5

Thank you for your response, but this not the case. It quoted with double quotes.

Thank you


#6

The same sqoop command is working on the LAB but not with CLoudera QuickStart VM. The problem seems to be with cloudera QS VM default setting.

Can any body tell that what should I do to get this command run?

Thanks


#7

Can any body resolve my issue?

Thanks in Advance :blush:


#8

Guys, I could solve this problem myself. actually there was a little mistake, that is, there should not be blankspace between two specified column names even it has “,” in --columns parameter.

it was really cool :blush
Thanks