Hello Mahebub,

Bogi is correct and great answer btw.

To the best of my knowledge, with Sqoop and Hive Partitioning the following
rules apply:
1. With static partitions you can use either (--hive-import or --hcatalog
options)
2. With dynamic partitions you can only use (--hcatalog options)

Example (static):
sqoop import --connect $MYCONN --username $MYUSER --password $MYPSWD
--table t1 --columns c1,c2 --where "p1 = 1" --num-mappers 1 --hive-import
--hive-database default --hive-table t1_partition --hive-partition-key
<col> --hive-partition-value <value>

Example (dynamic):
sqoop import --connect $MYCONN --username $MYUSER --password $MYPSWD
--table t1 --hcatalog-database default --hcatalog-table t1_partitioned
--num-mappers 1 --verbose --where "c1 > 1" --hive-partition-value <col>





Markus Kemper
Customer Operations Engineer
[image: www.cloudera.com] <http://www.cloudera.com>


On Mon, Aug 15, 2016 at 9:19 AM, Boglarka Egyed <[email protected]> wrote:

> Hi Mahebub,
>
> Unfortunatelly, using *--hive-partition-key* and *--hive-partition-value*
> requires each Sqoop statement to be imported into a single Hive partition.
> There is currently no support for Hive auto-partitioning. Instead, if a
> data set is to be imported into multiple partitions in a table, separate
> Sqoop statements are needed for insertion into each partition.
>
> However, using *--hcatalog-partition-keys *and
> *--hcatalog-partition-values *you can specify multiple static partition
> key/value pairs, please find the details in the User Guide:
> https://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_sqoop_hcatalog_
> integration
>
> Best Regards,
> Bogi
>
> On Mon, Aug 15, 2016 at 9:51 AM, Mahebub Sayyed <[email protected]>
> wrote:
>
>> I need to create/import  hive table having three Partitions
>> year/month/day using Sqoop. I have checked *--hive-partition-key* and
>> *--hive-partition-value* in sqoop. using these parameters I have created
>> partition *year* like this --hive-partition-key year
>> --hive-partition-value '2016' My question is how to pass multiple values
>> for partition-key and partition-value to create partitions like
>> year/month/day.
>>
>> --
>> *Regards,*
>> *Mahebub Sayyed*
>>
>
>

Reply via email to