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

Atul Gupta commented on SQOOP-2328:
-----------------------------------

here is the DB2 create table statement. Let me know if you need more 
information.

CREATE TABLE MYTABLE (NAME VARCHAR(50) NOT NULL, ID INTEGER NOT NULL, SALARY 
DECIMAL(5,0) NOT NULL, ETL_UPDATE_DATETM TIMESTAMP NOT NULL, PRIMARY KEY (ID));

> Sqoop import does not recognize Primary Key of a IBM DB2 table
> --------------------------------------------------------------
>
>                 Key: SQOOP-2328
>                 URL: https://issues.apache.org/jira/browse/SQOOP-2328
>             Project: Sqoop
>          Issue Type: Bug
>    Affects Versions: 1.4.5
>         Environment: IBM DB2 9,.7V
>            Reporter: Atul Gupta
>             Fix For: 1.4.6
>
>
> Currently Sqoop import query does not recognize the PK of IBM DB2 table.
> When any sqoop query runs for DB2 table, it is not able to recognize the 
> primary key(PK) of that table, which is used as --split-by column implicitly. 
> To run the Sqoop query it is mandatory to give --split-by <colname> 
> explicitly. 
> Query Given below:
> {code}
> sqoop import -Dmapred.job.queue.name=edwdev --connect 
> jdbc:db2://dle-db2edw01.dl.karmalab.net:50001/EXPDEV01 --username='********' 
> -P --table edwdev.mytable --hive-import --hive-table platdev.mytable_dynapart 
> --hive-external-table --target-dir /user/lbansal/hive_data_dynapart/testdir 
> --hive-dynamic-partition --hive-partition-key DATE 
> --hive-partition-key-format aa-zzzz --incremental lastmodified --check-column 
> DATE --last-value '2014-10-22' --append
> gives the following error message:
> 14/11/21 02:17:32 INFO manager.SqlManager: Executing SQL statement: SELECT 
> t.* FROM edwdev.mytable AS t WHERE 1=0
> 14/11/21 02:17:33 INFO tool.ImportTool: Incremental import based on column 
> DATE
> 14/11/21 02:17:33 INFO tool.ImportTool: Lower bound value: '2014-10-22'
> 14/11/21 02:17:33 INFO tool.ImportTool: Upper bound value: '2014-11-21 
> 02:17:33.680951'
> 14/11/21 02:17:34 INFO hive.metastore: Trying to connect to metastore with 
> URI thrift://cheledwhdd004.karmalab.net:9083
> 14/11/21 02:17:34 INFO hive.metastore: Connected to metastore.
> 14/11/21 02:17:34 WARN tool.HiveUtil: platdev.mytable_dynapart table not found
> 14/11/21 02:17:34 WARN tool.HiveUtil: platdev.mytable_dynapart table not found
> 14/11/21 02:17:34 ERROR tool.ImportTool: Error during import: No primary key 
> could be found for table edwdev.mytable. Please specify one with --split-by 
> or perform a sequential import with '-m 1'.
> {code}



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

Reply via email to