Support Questions
Find answers, ask questions, and share your expertise

How -m argument works in sqoop import command ?

Expert Contributor

when there is no primary key in table in RDBMS and i want to import that table to Hadoop using sqoop import command i have to use -m 1 argument. how this argument works internally that allows to import table without primary key. ? thank you.


Re: How -m argument works in sqoop import command ?

Witm -m 1, that single mapper will get the whole table using something like "SELECT * from your_table". So, very simple, and no issues if your table is not large. When you specify more than 1 mapper, each of them will do something like "SELECT * from your_table where id>=10000 and id<20000", where id is your primary key, and max(id)-min(id) = m*10000. So for best results your primary key should be uniformly distributed.