Support Questions

Find answers, ask questions, and share your expertise

How to load data from a text file into hbase??

avatar

Please can someone help me to load a text file data into hbase??

1 ACCEPTED SOLUTION

avatar

I resolve the problem, i start by a programm for replacing "," by "#" then i store it into hbase, thank you

View solution in original post

6 REPLIES 6

avatar
Super Guru
@Abdelmajid Boutjim

The best answer will depend on what the data looks like and what tools you have available. A common way to load csv based text files into HBase is to use the importtsv tool: http://hbase.apache.org/0.94/book/ops_mgt.html#importtsv

Take a look at this HCC article: https://community.hortonworks.com/articles/4942/import-csv-data-into-hbase-using-importtsv.html which is a tutorial you can follow.

avatar
Super Guru

Newer version of documentation for ImportTSV -- http://hbase.apache.org/book.html#importtsv

avatar

I'm taking about a text file, i have many comments on a product separated with a return to the line, i can't use the command for TSV because in the comments users are using comma? i have a brut comments which i want to store and after doing some processing to them

the format of the file:

bla bla, comment of a user____heloo, i love the prudct......

i din't like it balabndspjdf qsd;;;; ...................................

.

.

and so on

avatar
Super Guru

@Abdelmajid Boutjim

If you have commas embedded within the data itself and your columns are not using quotes, then your problem is much more difficult. Your data can be any length so tackling this is hard to do programmatically. Is there anyway to get a new export of the data using a different delimiter like ~ or | or having each column of data quoted?

avatar

I resolve the problem, i start by a programm for replacing "," by "#" then i store it into hbase, thank you

avatar
New Contributor

@Abdelmajid Boutjim

Hive HBase Integration will help you.

1. Create table in Hive and load data from text file (Table1)

2. Create another table in Hive integrating Hbase, which will create table in Hbase. (Table2)

3. Insert data from Table1 into Table2 using Hive INSERT OVERWRITE and data will also be available in HBase table.

4. Delete Hive Table1