Import SQL Server table to HDFS Import SQL Server table to HDFS hadoop hadoop

Import SQL Server table to HDFS


  1. How to import whole database into hadoop using sqoop and any otherway.

    You can use sqoop-import-all-tables to do that. Other way wouldbe to write your own job using DBInputFormat.

  2. How can I import a single table which don't have primary key or isit possible to import SQL Server table which don't have primary key.

    You can use --split-by to specify a column other than primary key column.


For the 2nd question-How can I import a single table which don't have primary key or is it possible to import SQL Server table which don't have primary key.

When the table we import does not have a primary key we need to specify in the commands as to how many mappers are to be used. this can be specified by the options "-m" or "--Split-by" in the sqoop import

e.g:

$ bin/sqoop import -connect jdbc:mysql://localhost:3306/db1 -username root -password password --table tableName --target-dir /user/tableName -m 1