Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Sqoop, mail # user - export from hdfs to mysql when has a auto_increment  field


+
刘光胜 2014-01-15, 03:41
Copy link to this message
-
Re: export from hdfs to mysql when has a auto_increment  field
Jarek Jarcec Cecho 2014-01-20, 17:41
I believe that you can use parameter --columns to specify what subset of columns is available in the file on HDFS.

Jarcec

On Wed, Jan 15, 2014 at 11:41:44AM +0800, 刘光胜 wrote:
> hi everyone ,is there any way to do this  export using sqoop/sqoop2
>
> hdfs file like this:
> (name   uid     url)
>
> bill,123,www.good.com
> tony,321,www.bad.com
> .....
>
> mysql table like this:
>
> mysql> select * from page;
> +----+----------+-----+----------------+
> | id    | name     |    uid | url                   |
> +----+----------+-----+----------------+
> |  1    | shelocks | 123  | www.abc.com |
> +----+----------+-----+----------------+
> 1 row in set (0.00 sec)
>
> mysql> desc page;
> +-------+--------------+------+-----+---------+----------------+
> | Field | Type         | Null | Key | Default | Extra          |
> +-------+--------------+------+-----+---------+----------------+
> | id        | int(3)             | NO   | PRI | NULL    | auto_increment |
> | name  | char(10)        | NO   |       | NULL    |                |
> | uid      | int(10)           | NO   |       | NULL    |                |
> | url       | varchar(126) | NO   |       | NULL    |                |
> +-------+--------------+------+-----+---------+----------------+
> 4 rows in set (0.00 sec)
>
> the table has a auto_increment  field,but hdfs not.is there any way to
> export hdfs to mysql table?
>
> thanks!
>
>
>
>
> [EMAIL PROTECTED]