|
|
-
RE: How to use sqoop importKartashov, Andy 2013-03-01, 14:26
p.s. Missed the parenthesis
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 From: Kartashov, Andy [mailto:[EMAIL PROTECTED]] Sent: Friday, March 01, 2013 9:21 AM To: [EMAIL PROTECTED] Subject: RE: How to use sqoop import 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:[EMAIL PROTECTED]]<mailto:[mailto:[EMAIL PROTECTED]]> Sent: Friday, March 01, 2013 8:07 AM To: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> 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 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 |