mRhNs13
mRhNs13

Reputation: 479

How to get column names from column family in HBase using rest api?

I am trying to get column names for a table in hbase using rest api. Url : http://localhost:10005/Customers/schema enter image description here

Am able to get only the column family name ("Info"). But I need to get all the column names present in the table. Please let me know how to get it using rest api.? Thanks in advance.

Upvotes: 1

Views: 1875

Answers (2)

Mahendra Kapadne
Mahendra Kapadne

Reputation: 426

Yes I agree with @AdamSkywalker. To get column name of Hbase table you have to do full table scan because Hbase is schema less database so you can’t retrieve metadata in simple way. Anyway retrieving column name for schema less table is not a good option.

It depends your usage of Hbase( I mean how you are storing data)

  1. Storing Schema less data ( but looking at you example it seem this not your use case)
  2. Structured schema. ( The way your use case shows behaviour, which means you are not dynamically gonna add columns )

When you are using Hbase with structured schema, you might have written API to maintain contracts between your Hbase table data and objects you are using to insert data. (something like For example. CustomerHbaseMapper.java) So you can enhance same API to return the columns of the Hbase table.

Upvotes: 0

AdamSkywalker
AdamSkywalker

Reputation: 11619

There is no schema for columns in HBase, you don't need to declare them in advance, in other words you can insert data in any column inside a column family.

As a result, if you want to know what columns are there in a table, you have to perform a full scan and analyze each cell. So I doubt there is a REST API method for that.

Upvotes: 0

Related Questions