You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Jarek Jarcec Cecho (JIRA)" <ji...@apache.org> on 2014/01/15 16:39:24 UTC

[jira] [Updated] (SQOOP-1267) Add functionality to export a subset of columns ignoring columns other than the ones in "--columns" list

     [ https://issues.apache.org/jira/browse/SQOOP-1267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jarek Jarcec Cecho updated SQOOP-1267:
--------------------------------------

    Description: 
Currently we can export a subset of columns with --columns flag (SQOOP-503). However, other columns are reported as NULLS in the final table. Instead we can add a flag that eliminates the columns other than the ones in --columns flag. This way we can just export a subset of columns ignoring others.

Example: 

Sample file is as follows:- 
{code}
12|jithin|aluva|good 
23|syam|aluva|good 
34|john|prbr|cool 
35|ramesh|ankly|fare 
{code}

MYSQL sample table is having the following schema:- 
{code}
| id | name | place | comments | 
{code}

we executed the sqoop command as :- 
{code}
sqoop export --connect jdbc:mysql://hostname/test --username uname -P --export-dir /user/johnj2/sqoopexport/ --input-fields-terminated-by '|' --table sqooptest --columns name,place 
{code}

Job went success and data is exported into mysql as follows :- 
{code}
+------+------+--------+----------+ 
| id | name | place | comments | 
+------+------+--------+----------+ 
| NULL | 35 | ramesh | NULL | 
| NULL | 12 | jithin | NULL | 
| NULL | 23 | syam | NULL | 
| NULL | 34 | john | NULL | 
+------+------+--------+----------+ 
{code}

Instead we can add a flag that ignores columns id and comments.

  was:
Currently we can export a subset of columns with --columns flag (SQOOP-503). However, other columns are reported as NULLS in the final table. Instead we can add a flag that eliminates the columns other than the ones in --columns flag. This way we can just export a subset of columns ignoring others.

Example: 

Sample file is as follows:- 
12|jithin|aluva|good 
23|syam|aluva|good 
34|john|prbr|cool 
35|ramesh|ankly|fare 

MYSQL sample table is having the following schema:- 
| id | name | place | comments | 

we executed the sqoop command as :- 
sqoop export --connect jdbc:mysql://hostname/test --username uname -P --export-dir /user/johnj2/sqoopexport/ --input-fields-terminated-by '|' --table sqooptest --columns name,place 

Job went success and data is exported into mysql as follows :- 
+------+------+--------+----------+ 
| id | name | place | comments | 
+------+------+--------+----------+ 
| NULL | 35 | ramesh | NULL | 
| NULL | 12 | jithin | NULL | 
| NULL | 23 | syam | NULL | 
| NULL | 34 | john | NULL | 
+------+------+--------+----------+ 

Instead we can add a flag that ignores columns id and comments.


> Add functionality to export a subset of columns ignoring columns other than the ones in "--columns" list
> --------------------------------------------------------------------------------------------------------
>
>                 Key: SQOOP-1267
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1267
>             Project: Sqoop
>          Issue Type: Improvement
>          Components: sqoop2-framework
>    Affects Versions: 2.0.0
>            Reporter: bharath v
>            Priority: Minor
>
> Currently we can export a subset of columns with --columns flag (SQOOP-503). However, other columns are reported as NULLS in the final table. Instead we can add a flag that eliminates the columns other than the ones in --columns flag. This way we can just export a subset of columns ignoring others.
> Example: 
> Sample file is as follows:- 
> {code}
> 12|jithin|aluva|good 
> 23|syam|aluva|good 
> 34|john|prbr|cool 
> 35|ramesh|ankly|fare 
> {code}
> MYSQL sample table is having the following schema:- 
> {code}
> | id | name | place | comments | 
> {code}
> we executed the sqoop command as :- 
> {code}
> sqoop export --connect jdbc:mysql://hostname/test --username uname -P --export-dir /user/johnj2/sqoopexport/ --input-fields-terminated-by '|' --table sqooptest --columns name,place 
> {code}
> Job went success and data is exported into mysql as follows :- 
> {code}
> +------+------+--------+----------+ 
> | id | name | place | comments | 
> +------+------+--------+----------+ 
> | NULL | 35 | ramesh | NULL | 
> | NULL | 12 | jithin | NULL | 
> | NULL | 23 | syam | NULL | 
> | NULL | 34 | john | NULL | 
> +------+------+--------+----------+ 
> {code}
> Instead we can add a flag that ignores columns id and comments.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)