There are two ways to import data from sqoop. Table dump (without select statements) Example: sqoop import --connect jdbc:mysql://<host>/<database> --username <name> --password <"*****"> --table <table name> -m 1 --fields-terminated-by <choose any delimiter of your choice>
the -m 1 will give you one input split. If you were to increase that number than you will have to add -split-by <table field> In case you decide to use select statement in your import: Example: sqoop import --connect jdbc:mysql://<host>/<database> --username <name> --password <"*****"> --fields-terminated-by ',' --query "select field1,field2... from <table name> WHERE \$CONDITIONS <conditions> --target-dir <name of directory if you want> --split-by <field1> -m 3 Good luck. Rgds, AK-47 From: vasanth kumar [mailto:rj.vasanthku...@gmail.com] Sent: Friday, March 01, 2013 8:07 AM To: user@hadoop.apache.org Subject: Re: How to use sqoop import Try this ./sqoop import --connect jdbc:mysql://localhost/my --username user --password 1234 --query 'select * from table where id=5 AND $CONDITIONS' --split-by table.id<http://table.id> --target-dir /dir you must specify --split-by and --target-dir On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <samir.help...@gmail.com<mailto:samir.help...@gmail.com>> wrote: Hi All, Can any one share some example how to run sqoop "Import results of SQL 'statement'" ? for example: sqoop import -connect jdbc:......... --driver xxxxxxxxxxx after this if i am specifying --query "select statement " it is even not recognizing as sqoop valid statement.. Regards, samir. -- Regards Vasanth kumar RJ NOTICE: This e-mail message and any attachments are confidential, subject to copyright and may be privileged. Any unauthorized use, copying or disclosure is prohibited. If you are not the intended recipient, please delete and contact the sender immediately. Please consider the environment before printing this e-mail. AVIS : le pr?sent courriel et toute pi?ce jointe qui l'accompagne sont confidentiels, prot?g?s par le droit d'auteur et peuvent ?tre couverts par le secret professionnel. Toute utilisation, copie ou divulgation non autoris?e est interdite. Si vous n'?tes pas le destinataire pr?vu de ce courriel, supprimez-le et contactez imm?diatement l'exp?diteur. Veuillez penser ? l'environnement avant d'imprimer le pr?sent courriel