Support Questions

Find answers, ask questions, and share your expertise

creating two column familes with one sqoop command

avatar
Super Collaborator

the command below creates one column family successfully , how can I add another column family to this command ?

sqoop import --connect "jdbc:oracle:thin:@(description=(address=(protocol=tcp)(host=patronQA)(port=1526))(connect_data=(service_name=patron)))" --username PATRON --password xxxx --table PATRON.AUDIT_TOUR_SMALL --hbase-table AUDIT_TOUR --column-family TOUR --hbase-row-key "TOUR_ID" --hbase-create-table --columns "TOUR_ID,HOST_TOUR_ID,PLAZA_ID,REV_DAY_ID,LANE_ID,HOST_EMP_ID" -m 1
1 ACCEPTED SOLUTION

avatar
Master Guru

You import into hbase column family one at a time. if you have 2 column families you import into each with two sqoop run. if you have 3 CF then it takes 3 sqoop runs.

Here is good examples from here

$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,customername" 
    --hbase-table customercontactinfo 
    --column-family CustomerName 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 16:53:01 INFO mapreduce.ImportJobBase: Retrieved 5 records.
$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,contactinfo" 
    --hbase-table customercontactinfo 
    --column-family ContactInfo 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 17:00:59 INFO mapreduce.ImportJobBase: Retrieved 5 records.
$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,productnums" 
    --hbase-table customercontactinfo 
    --column-family ProductNums 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 17:05:54 INFO mapreduce.ImportJobBase: Retrieved 5 records.

View solution in original post

1 REPLY 1

avatar
Master Guru

You import into hbase column family one at a time. if you have 2 column families you import into each with two sqoop run. if you have 3 CF then it takes 3 sqoop runs.

Here is good examples from here

$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,customername" 
    --hbase-table customercontactinfo 
    --column-family CustomerName 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 16:53:01 INFO mapreduce.ImportJobBase: Retrieved 5 records.
$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,contactinfo" 
    --hbase-table customercontactinfo 
    --column-family ContactInfo 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 17:00:59 INFO mapreduce.ImportJobBase: Retrieved 5 records.
$ sqoop import 
    --connect jdbc:mysql://localhost/serviceorderdb 
    --username root -P 
    --table customercontactinfo 
    --columns "customernum,productnums" 
    --hbase-table customercontactinfo 
    --column-family ProductNums 
    --hbase-row-key customernum -m 1
Enter password:
...
13/08/17 17:05:54 INFO mapreduce.ImportJobBase: Retrieved 5 records.