In this article, we will see some HBase query examples using HappyBase python and shell commands. For this article, Hadoop and HBase services are running through the HBase docker image, which is already up and running. Let’s see how it all works in conjunction.
Prerequisite
- Docker should be installed. (How to install Docker)
- Docker HBase Container should be up and running (Check how)
- HappyBase connection through Python should be done (Check how)
Table of Content
- What is HBase Database?
- HBase Queries Examples Through Shell
- HBase Queries by python HappyBase example
- FAQ
What is HBase Database?
HBase is a non-relational database management system built on top of Apache Hadoop. It is fault tolerant. It provides real-time data access from and to HDFS. HBase also performs compressions of data. It can hold billions of records of data and provides low latency in fetching records from those big data.
1. HBase Queries Examples Through Shell
For this step, the 3rd point in the prerequisite should be completed. You should first bash into the Docker HBase container and open the HBase shell terminal with this command:
Create Table:
This will create a table named ‘transaction’ and the remaining fields would be the columns.
create ‘transaction’, ‘amount’, ‘card_type’, ‘websitename’, ‘countryname’, ‘datetime’, ‘transactionID’, ‘cityname’, ‘productname’
Show tables list:
list
Insert into Table:
put ‘transaction’, ‘2’, ‘card_type’, ‘MasterCard’
put ‘transaction’, ‘3’, ‘card_type’, ‘Visa’
put ‘transaction’, ‘4’, ‘card_type’, ‘MasterCard’
put ‘transaction’, ‘5’, ‘card_type’, ‘Maestro’
put ‘transaction’, ‘1’, ‘amount’, ‘50.87’
put ‘transaction’, ‘2’, ‘amount’, ‘1023.2’
put ‘transaction’, ‘3’, ‘amount’, ‘3321.1’
put ‘transaction’, ‘4’, ‘amount’, ‘234.11’
put ‘transaction’, ‘5’, ‘amount’, ‘321.11’
Count Total Rows in Table:
count ‘transaction’
Describe the Table and its Fields:
describe ‘transaction’
See if Table Exists:
exists ‘transaction’
Fetch Item from Table:
get ‘transaction’, ‘2’
get ‘transaction’, ‘5’
Fetch All from Table:
scan ‘transaction’
Delete a Cell Value:
delete ‘transaction’, ‘4’, ‘card_type’
Delete a Row in Table:
deleteall ‘transaction’, ‘4’
Drop Entire Table:
disable ‘transaction’
drop ‘transaction’
ALter Table:
alter ‘transaction’, NAME => ‘card_type’, VERSIONS => 5
Fyetch First 2 Rows:
scan ‘transaction’, {FILTER => “PageFilter(2)”}
Fetch Data Where Values are Matching with String> ‘Mas’
scan ‘transaction’, {COLUMNS => ‘card_type’, FILTER => “ValueFilter(=, ‘substring:Mas’)”}
Fetch Only Columns:
scan ‘transaction’, {FILTER => “KeyOnlyFilter()”}
Fetch Rows Where the RowKey Matched the Pattern:
scan ‘transaction’, {FILTER => “PrefixFilter(‘1’)”
To Fetch Columns Only for RowKey Matching = 2:
scan ‘transaction’, {FILTER => “PrefixFilter(‘2’) AND KeyOnlyFilter()”}
Find Column Families Which Start with ‘c’ and/or ‘p’
scan ‘transaction’, {FILTER => “ColumnPrefixFilter(‘c’)”}
scan ‘transaction’, {FILTER => “MultipleColumnPrefixFilter(‘c’,’p’)”}
Fetch Rows Starting from RowKey 3 and Onwards:
scan ‘transaction’, {STARTROW => ‘3’}
Fetch 3 Rows with The Column Family Starting with The Letter ‘c’
scan ‘transaction’, {FILTER => “PageFilter(3) AND ColumnPrefixFilter(‘c’)”}
More HBase Examples
For more examples and detailed explanations, I’ve found 2 online resources that may help you. Check them out:
2. HBase Queries by Python HappyBase Example
Earlier we saw a lot of HBase query examples but using shell commands. In this step, we will connect HBase with Python and then execute queries. For this, we will use the HappyBase Python library, whose configuration you can find in this article. Before we start, you can look at the Official Documentation for HappyBase Library. Let’s get started.
Create Table if not exists:
Add Data into Table:
Check out Table.put() official docs.
Fetch Data from Table:
Delete Data from Table:
FAQ
As mentioned here:
‘HBase provides a dual approach to data access. While it’s row key based table scans provide consistent and real-time reads/writes, it also leverages Hadoop MapReduce for batch jobs. This makes it great for both real-time querying and batch analytics. Hbase also automatically manages sharding and failover support.’
Yes. HBase is an open-source NoSQL database which follows columnar format for storing large data.
HappyBase is a python 3rd party library which is used to communicate HBase with Python script. We could use happybase connection to execute queries in HBase database with large datasets.
And that’s a wrap!
Thank you for going through my article, regarding HBase Query Examples Using HappyBase python and Shell Commands. I hope that you found it helpful and were able to comprehend it. Feel free to share your thoughts and opinions, in the comments section down below.
Have a great one!
Recent Posts
- Lemon Casino – szczegowa recenzja Lemon Kasyno.21186
- онлайн – Gama Casino Online – обзор 2026.3907
- Famous casinos that define the ultimate gambling experience worldwide
- Mostbet AZ – bukmeker ve kazino Mostbet Giri rsmi sayt.6586 (2)
- Understanding responsible gambling A guide to making informed choices
Recent Comments
Archives
- June 2026
- May 2026
- October 2025
- October 2024
- September 2024
- August 2024
- June 2024
- January 2024
- November 2023
- October 2023
- September 2023
- August 2023
- June 2023
- May 2023
- March 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
Categories
- 21
- aks 1 en
- aks 18
- aks 28
- aks 31
- Angular
- AWS
- Backend Development
- Big Data
- Blog
- Cloud
- crypto 01
- crypto 05
- crypto 15
- crypto 19 en
- crypto 20
- crypto 20.05
- crypto 21.05
- crypto 29
- crypto 5
- Database
- Deployment
- DevOps
- Docker
- fi
- Frontend Development
- GitHub
- Google Cloud Platform
- hu
- Installations
- it
- Java
- JavaScript
- Linux
- MySQL
- Networking
- News
- nl
- no
- NodeJS
- Online casino
- Operating System
- Post
- public
- Python
- Python Flask
- Report
- Security
- Server
- SpringBoot
- Subdomain
- sushicasino 13
- TypeScript
- Uncategorized
- VSCode
- Webhosting
- WordPress
- Στοιχηματικές
Search
Recent Post
Lemon Casino – szczegowa recenzja Lemon Kasyno.21186
- 26 June, 2026
- 5 min read
онлайн – Gama Casino Online – обзор
- 26 June, 2026
- 1 min read
Famous casinos that define the ultimate gambling
- 26 June, 2026
- 6 min read