Home Forums Sqoop Sqoop import with no primary key

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Mahesh Balakrishnan 6 months, 3 weeks ago.

  • Creator
    Topic
  • #47530

    Swapnil Patil
    Participant

    I am importing database from MS SQL server 2008.. I have 100 tables in the database but only 10 tables have primary keys defined on it. So, when I migrate entire database with import-all-tables option it only migrate those tables which have primary key defined.

    ./sqoop import-all-tables –connect “jdbc:sqlserver://w.x.y.z:1433;database=db_name” –username user_name –password **** –hive-import –hive-database db_name -m 1

    This is the error I am getting
    ERROR tool.ImportAllTablesTool: Error during import: No primary key could be found for table xyz. Please specify one with –split-by or perform a sequential import with ‘-m 1′

    I dont want to migrate tables individually.. please help

    Thanks inadvance.. :)

Viewing 1 replies (of 1 total)

The topic ‘Sqoop import with no primary key’ is closed to new replies.

  • Author
    Replies
  • #49591

    Hi Swapnil,

    Unfortunately, for sqoop to import all tables in one command, the tables would need to have a primary key.

    From http://sqoop.apache.org/docs/1.4.1-incubating/SqoopUserGuide.html

    For the import-all-tables tool to be useful, the following conditions must be met:

    Each table must have a single-column primary key.
    You must intend to import all columns of each table.
    You must not intend to use non-default splitting column, nor impose any conditions via a WHERE clause

    -Mahesh

    Collapse
Viewing 1 replies (of 1 total)