Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop >> mail # user >> Using cast in sqoop export


Copy link to this message
-
Re: Using cast in sqoop export
Hi sir,
Sqoop is not reading data types from HIVE during export job. All data types are inferred from your MySQL table. Thus you should not need to do any explicit casting. Would you mind sharing more details about your use case?

Jarcec

On Thu, Dec 13, 2012 at 11:20:21PM +0530, dyuti a wrote:
> Hi All,
> Am trying to cast the datatype while doing an export from hive to mysql (
> string from hive to Int in mysql).Is it possible with any of the options?
>
> //Tried
> sqoop export --connect jdbc:mysql://localhost:3306/mydatabase --username
> gact -P --query "SELECT cast(firstname AS int),cast(lastname AS int) from
> test3" --table test3 --export-dir /user/hive/warehouse/test;
>
> //But got below errors:
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Error parsing arguments for
> export:
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument: --query
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument: SELECT
> cast(firstname) AS int,cast(lastname) AS int from test
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument: --table
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument: test3
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument:
> --export-dir
> 12/12/13 10:36:24 ERROR tool.BaseSqoopTool: Unrecognized argument:
> /user/hive/warehouse/test
>
> from the above error i found like it is not possible to use --query in
> export.
>
> is there any other way to achieve this? i know it is simple by having the
> exact datatype and do a normal export to mysql table but i badly wanna to
> check with this...........
>
> Thanks for your help!
>
> Regards,
> dti
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB