You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@sqoop.apache.org by YouPeng Yang <yy...@gmail.com> on 2013/05/22 08:49:04 UTC

Export in free from

Hi
  I want to  export data on the HDFS to the oracle database with
sqoop-1.4(sqoop-1.4.1-cdh4.1.2). However the columns betwean HDFS and
Oracle table  are  not exactly same to each other.

 For example,Data on HDFS:
-------------------------------------------------------------
| ID |      TIMEID          |   COLA  | COLB  |
-------------------------------------------------------------
| 6  |  201305221335    |    0        |  20      |
-------------------------------------------------------------

the Oracle table:
------------------------------------------------------------------------
| ID |      TIMEID          |   COLC  | COLB   | COLA |
------------------------------------------------------------------------
| 7  |  201305221335    |     kk      |  20      |  1       |
------------------------------------------------------------------------
Note:Additional COLC and unsame order.


I notice the sqoop export command:
--export-dir   HDFS source path for the export
--table  Table to populate.
It seams not to export the data to oracle in free from just as Free-form
Query Imports
using the --query argument.

Could I acheive that goal ?

Thanks very much

Regards

Re: Export in free from

Posted by Jarek Jarcec Cecho <ja...@apache.org>.
Hi YouPeng,
Sqoop 1 do not supports custom insert query when exporting data from HDFS. I think that in your use case you can use parameter --columns to specify which columns and in what order are present on HDFS, for example:

  sqoop ... --columns ID,TIMEID,COLA,COLB

Jarcec

On Wed, May 22, 2013 at 02:49:04PM +0800, YouPeng Yang wrote:
> Hi
>   I want to  export data on the HDFS to the oracle database with
> sqoop-1.4(sqoop-1.4.1-cdh4.1.2). However the columns betwean HDFS and
> Oracle table  are  not exactly same to each other.
> 
>  For example,Data on HDFS:
> -------------------------------------------------------------
> | ID |      TIMEID          |   COLA  | COLB  |
> -------------------------------------------------------------
> | 6  |  201305221335    |    0        |  20      |
> -------------------------------------------------------------
> 
> the Oracle table:
> ------------------------------------------------------------------------
> | ID |      TIMEID          |   COLC  | COLB   | COLA |
> ------------------------------------------------------------------------
> | 7  |  201305221335    |     kk      |  20      |  1       |
> ------------------------------------------------------------------------
> Note:Additional COLC and unsame order.
> 
> 
> I notice the sqoop export command:
> --export-dir   HDFS source path for the export
> --table  Table to populate.
> It seams not to export the data to oracle in free from just as Free-form
> Query Imports
> using the --query argument.
> 
> Could I acheive that goal ?
> 
> Thanks very much
> 
> Regards