You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by samir das mohapatra <sa...@gmail.com> on 2013/03/01 08:02:54 UTC

How to use sqoop import

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.

Re: How to use sqoop import

Posted by abhijeet gaikwad <ab...@gmail.com>.
Also required: --query or --table .
If your table has a primary key, --split-by is optional.

Detailed:
Have a look at sqoop documentation here <http://sqoop.apache.org/docs/>.
v1.4.2 user guide: http://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html

Thanks,
Abhijeet

On Fri, Mar 1, 2013 at 6:36 PM, vasanth kumar <rj...@gmail.com>wrote:

> 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 --target-dir /dir
>
> you must specify --split-by and --target-dir
>
>
>
>
> On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
> samir.helpdoc@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
>

Re: How to use sqoop import

Posted by abhijeet gaikwad <ab...@gmail.com>.
Also required: --query or --table .
If your table has a primary key, --split-by is optional.

Detailed:
Have a look at sqoop documentation here <http://sqoop.apache.org/docs/>.
v1.4.2 user guide: http://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html

Thanks,
Abhijeet

On Fri, Mar 1, 2013 at 6:36 PM, vasanth kumar <rj...@gmail.com>wrote:

> 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 --target-dir /dir
>
> you must specify --split-by and --target-dir
>
>
>
>
> On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
> samir.helpdoc@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
>

Re: How to use sqoop import

Posted by abhijeet gaikwad <ab...@gmail.com>.
Also required: --query or --table .
If your table has a primary key, --split-by is optional.

Detailed:
Have a look at sqoop documentation here <http://sqoop.apache.org/docs/>.
v1.4.2 user guide: http://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html

Thanks,
Abhijeet

On Fri, Mar 1, 2013 at 6:36 PM, vasanth kumar <rj...@gmail.com>wrote:

> 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 --target-dir /dir
>
> you must specify --split-by and --target-dir
>
>
>
>
> On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
> samir.helpdoc@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
>

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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:Andy.Kartashov@mpac.ca]
Sent: Friday, March 01, 2013 9:21 AM
To: user@hadoop.apache.org
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:rj.vasanthkumar@gmail.com]<mailto:[mailto:rj.vasanthkumar@gmail.com]>
Sent: Friday, March 01, 2013 8:07 AM
To: user@hadoop.apache.org<ma...@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 <sa...@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
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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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:Andy.Kartashov@mpac.ca]
Sent: Friday, March 01, 2013 9:21 AM
To: user@hadoop.apache.org
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:rj.vasanthkumar@gmail.com]<mailto:[mailto:rj.vasanthkumar@gmail.com]>
Sent: Friday, March 01, 2013 8:07 AM
To: user@hadoop.apache.org<ma...@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 <sa...@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
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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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:Andy.Kartashov@mpac.ca]
Sent: Friday, March 01, 2013 9:21 AM
To: user@hadoop.apache.org
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:rj.vasanthkumar@gmail.com]<mailto:[mailto:rj.vasanthkumar@gmail.com]>
Sent: Friday, March 01, 2013 8:07 AM
To: user@hadoop.apache.org<ma...@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 <sa...@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
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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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:Andy.Kartashov@mpac.ca]
Sent: Friday, March 01, 2013 9:21 AM
To: user@hadoop.apache.org
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:rj.vasanthkumar@gmail.com]<mailto:[mailto:rj.vasanthkumar@gmail.com]>
Sent: Friday, March 01, 2013 8:07 AM
To: user@hadoop.apache.org<ma...@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 <sa...@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
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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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.vasanthkumar@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 <sa...@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

Re: How to use sqoop import

Posted by abhijeet gaikwad <ab...@gmail.com>.
Also required: --query or --table .
If your table has a primary key, --split-by is optional.

Detailed:
Have a look at sqoop documentation here <http://sqoop.apache.org/docs/>.
v1.4.2 user guide: http://sqoop.apache.org/docs/1.4.2/SqoopUserGuide.html

Thanks,
Abhijeet

On Fri, Mar 1, 2013 at 6:36 PM, vasanth kumar <rj...@gmail.com>wrote:

> 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 --target-dir /dir
>
> you must specify --split-by and --target-dir
>
>
>
>
> On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
> samir.helpdoc@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
>

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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.vasanthkumar@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 <sa...@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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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.vasanthkumar@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 <sa...@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

RE: How to use sqoop import

Posted by "Kartashov, Andy" <An...@mpac.ca>.
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.vasanthkumar@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 <sa...@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

Re: How to use sqoop import

Posted by vasanth kumar <rj...@gmail.com>.
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 --target-dir /dir

you must specify --split-by and --target-dir




On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
samir.helpdoc@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

Re: How to use sqoop import

Posted by vasanth kumar <rj...@gmail.com>.
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 --target-dir /dir

you must specify --split-by and --target-dir




On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
samir.helpdoc@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

Re: How to use sqoop import

Posted by vasanth kumar <rj...@gmail.com>.
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 --target-dir /dir

you must specify --split-by and --target-dir




On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
samir.helpdoc@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

Re: How to use sqoop import

Posted by vasanth kumar <rj...@gmail.com>.
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 --target-dir /dir

you must specify --split-by and --target-dir




On Fri, Mar 1, 2013 at 12:32 PM, samir das mohapatra <
samir.helpdoc@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