需求:
sqoop import \ --connect jdbc:mysql://DAQ102:3306/gmall \ --username root \ --password 123456 \ --table user_info \ --columns id,login_name,nick_name,name \ --where "id >=100 and id <=200" \ --target-dir "/user_info" \ --delete-target-dir \ --num-mappers 2 \ --split-by "id" \ --fields-terminated-by "\t"
改成sql语句形式:注意点:需要对$进行转义sqoop import \ --connect jdbc:mysql://DAQ102:3306/gmall \ --username root \ --password 123456 \ --query "select id,login_name,nick_name,name from user_info where id >=100 and id<=200 and \$CONDITIONS" \ --target-dir "/user_info" \ --delete-target-dir \ --num-mappers 2 \ --split-by "id" \ --fields-terminated-by "\t"