Updated March 27, 2023
Introduction to HBase Create Table
Hbase tables are mutatable, modifiable, and deletable. Hbase tables can also be created using HiveQL. HBase Apache is a database in Hadoop. It is scalable and can store Big data. Using access to your big data, one can use Apache HBase and do random, real-time write/read. Many methods can be accessed by HBase to interact with it. Java and Java API construct HBase and so, it is widely used to provide a lot of functionalities. HBase is called a HappyBase which is a developer-friendly library of Python which interacts with HBase Apache. Offering application developers, use of standard HBase setups, to interact with HBase. But, if Java is not the construct for HBase, it can provide you with two options. They are REST Interface and Thrift Interface.
Syntax of HBase:
Using HBase shell, creating a table: create is the command used to create an HBase table. Specification of Table name and Column Family name is necessary.
Syntax for creating a table in HBase shell:
create ‘ < name of table > ’ , ‘ < name of column family> ’
Example of HBase Create Table
Hbase tables are used for handling and hosting a very large range of data in the form of a table. This is for interacting and analyzing. Storage for multi-structured and scanty data can be done easily. Also a column orientation, nonrelational database management.
Thrift and REST Interfaces
- Thrift Interface is more of a lightweight and hence rapid of the two.
- REST interface is comparatively slow with respect to performance.
- REST interface uses HTTP verbs.
- Installation of HBase python is done from PyPI repository:
pip3 install hbase – python
The Flat – Wide and Tall – Narrow are two approaches used for the design of HBase tables. The approach selection, however, depends on what you want to achieve using any one of these methods. HBase performance directly depends on how data is accessed, that is, it completely depends on the Row – Key handling.
The difference in Tall – Narrow and Flat – Wide approaches is analogous to get and scan. Tall – Narrow approach, ideally, has less numbered rows and large numbered columns. And Flat – Wide approach has less numbered columns and large numbered rows. HBase is a No-SQL, value – type or a key database where a key is assigned to watch row.
For Example:
This is the conceptual representation of a table created in HBase. The table describes the keywords such as SFO and so on. The whole row is considered as column families.
Keys usually will not be there at the beginning. They are more for illustrative purposes. At HBase definition timing, one can specify one or more column’s families. A column family has created something like this:
Code:
create ‘ geog_origin ‘ , ‘ origin ’
Inserting data into the first row of the table:
Code:
put ' geog_origin ’ , ’ SFO ' , ' origin : airport_name ' , ' San Francisco , CA : San Francisco '
put ' geog_origin ’ , ’ SFO ' , ' origin : city ’ , ’ San Francisco , CA '
put ' geog_origin ’ ,’ SFO ' , ’ origin ' : state ' , ' California '
put ' geog_origin ’ , ' SFO ' , ’ origin ' : id ’ , ' 14771 '
Column families are each inserted into columns with its values individually. Deleted and retrieved using DELETE, PUT, GET commands. You have to prefix columns name with predefined column family and the key-value provision for the respective row you are about to insert it in. In the conceptual world, it looks something like this :
Updating, loading and deleting data in HBase tables is possible in Python. To overcome the problems of HDFS and Hive like write once and append, mutate, and manipulation of data is not possible, and hence HBase is a good medium. HBase can perform delete, insert and update operations.
Try typing “import this” on Python IDE, you’ll find a poem highlighting the philosophies of Python:
Code:
Import this
Conclusion
HBase is a database distribution. It is scalable and is used for Big data storage. We can create HBase tables and can also store huge data into these tables. Accessing the data inserted is also easy using the keywords Delete, Put and Get. HBase is always used by importing the HBase python package from the Python library.
Recommended Articles
This is a guide to HBase Create Table. Here we discuss the introduction, syntax and various examples of HBase Create Table. You may also have a look at the following articles to learn more –