sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ankit (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SQOOP-824) Sqoop code generation in 'update' export mode incompatible with '--columns' option
Date Fri, 17 Oct 2014 11:40:34 GMT

    [ https://issues.apache.org/jira/browse/SQOOP-824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14174955#comment-14174955
] 

Ankit commented on SQOOP-824:
-----------------------------

sqoop-export 
--connect jdbc:postgresql://<ip>/<database_name> 
--connection-manager com.cloudera.sqoop.manager.PostgresqlManager 
--username <name> 
--password <pass> 
--table <table_name> 
--update-key 'primary_key'   
--columns '<primary_key_column>,<col_1_tobeupdated>,<col_2_tobeupdated>'
 
--export-dir <export-director> 
-input-fields-terminated-by ',' -m 1 
-- --schema test_data
___________
sample file data :

871888,60.00
___________
871888 = colmn that goes in where clause
60.00 = woulbe upated in the column .

Hope this help i have invested lot of time apache sqoop dont have a proper documentation so
i am sharing that it could help other .

cheers .





> Sqoop code generation in 'update' export mode incompatible with '--columns' option
> ----------------------------------------------------------------------------------
>
>                 Key: SQOOP-824
>                 URL: https://issues.apache.org/jira/browse/SQOOP-824
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen, tools
>    Affects Versions: 1.4.2
>         Environment: {code}
> $ uname -a
> Linux precise32 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686
i686 i386 GNU/Linux
> $ hadoop version
> Hadoop 0.23.4
> Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23.4/hadoop-common-project/hadoop-common
-r 1392631
> Compiled by evans on Mon Oct 22 13:02:13 CDT 2012
> From source with checksum d5a2b33744f6dff6eecf84786baeb80c
> {code}
> Sqoop downloaded from http://www.eu.apache.org/dist/sqoop/1.4.2/sqoop-1.4.2.bin__hadoop-0.23.tar.gz
> Running in Vagrant VM with Ubuntu 12.04 LTS 32-bit.
>            Reporter: Stan Angeloff
>            Assignee: Jarek Jarcec Cecho
>            Priority: Minor
>              Labels: manager
>             Fix For: 1.4.3
>
>         Attachments: bugSQOOP-824.patch
>
>
> When using {{sqoop export}} with {{\-\-update-key}} and {{--columns}} the options are
incompatible. For example, given table {{T1}}
> {code}
>   +------+
>   | T1   |
>   +------+
>   | id   |
>   | name |
>   | mail |
>   | cell |
>   +-------
> {code}
> When using:
> {code}
> $ sqoop export [ .. ] --update-key id --update-mode allowinsert --columns id,name
> {code}
> the code generation utility creates a Java file which fails to compile.
> This seems to happen because {{ConnManager}} appends all table columns, even those not
mentioned on the command-line (see {{ConnManager.configureDbOutputColumns}}). As a result,
the generated class contains a {{write}} method which references class members which do not
exist.
> I could suggest two possible solutions: 1) either make this case an exception or 2) make
the code that appends all remaining table columns optional.
> I may be missing something as that code is there for a reason, but I can't see why?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message