Site icon Spark By {Examples}

HBase – Exists and Count with examples

This tutorial describes how to check/verify if the table exists and get the counts in a table using the HBase shell and will practice with some examples.

Verifying table exists using HBase Shell

Use exists command to verify if the table present in the database. Let’s see the syntax, usage with some examples.

Syntax: exists ‘<namespace>:<table_name>’

Example:

exists returns boolean along with the message. returns ‘true‘ when the table present in the database.

Returns ‘false‘ when table not present in the database.

Count Usage

Use count command to get the total records in a table. Let’s see the syntax, usage with some examples.

Syntax: count ‘<namespace>,<table_name>’

Returns the number of rows in a table.

When table is not found it returns an error ‘Unknown table’

Next, Let’s learn how to Disable and Enable a table.

Exit mobile version