ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / Managing databases / Big Data / Managing HBase databases
  • Overview
  • How is an HBase database organized?
  • How to handle an HBase database in programming?
  • How to create an HBase table?
  • How to retrieve the list of tables found in an HBase database?
  • How to retrieve the description of an HBase database?
  • How to delete an HBase table?
  • How to read the data found in an HBase database?
  • How to write data into an HBase database?
  • How to delete data from an HBase table?
  • How to perform a browse with filter in an HBase table?
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Managing HBase databases
Overview
HBase is a non-relational distributed database (NoSQL), based on columns and using a non-structured storage for large tables.
HBase is a core component of Hadoop.
HBase has been conceived for processing large volumes of data (several million rows, several million columns per row) and non-standard data (each row can have a structure different from the next row).
How is an HBase database organized?
In an HBase database, the data is stored in tables (files), in a denormalized way.
Each table is divided into families of columns (items), that themselves contain columns.
Each row (equivalent to a record in a traditional DBMS) is identified by a single "rowKey".
For each row, in the same family of columns, the number and the name of columns is free.
The "rowKey" is the single key of the table.
A cell is the intersection between a row and a column.
The history of the cell content is stored as well as its timestamp (date/time when it was written).
You have the ability to implement filters on an HBase table (a little bit like a filter on HFSQL).
How to handle an HBase database in programming?
WLanguage allows you to:
Please note: HBase functions are available for editing and execution only on Windows Vista or Windows Server 2008.

How to create an HBase table?

To create an HBase table, you must:
  1. Define and initialize a hbConnection variable.
  2. Define and initialize a hbTableDescription variable. This variable contains an array of hbColumnDescription variables describing the columns.
  3. Use the hbCreateTable function.Example:
// Connection
Connection is hbConnection
Connection.Server = "MyServer"
// Describe the table
TableDesc is hbTableDescription
TableDesc.Name = "blog"
// Describe the "Post" column
ColDesc is hbColumnDescription
ColDesc.Name = "Post"
Add(TableDesc.Column, ColDesc)
// Create the table
hbCreateTable(Connection, TableDesc)

How to retrieve the list of tables found in an HBase database?

To retrieve the list of tables found in an HBase database, you must:
  1. Define and initialize a hbConnection variable.
  2. Use the hbListTable function.Example:
// Connection
Connection is hbConnection
Connection.Server = "MyServer"
// Display the list of tables
Trace(hbListTable(Connection))

How to retrieve the description of an HBase database?

To retrieve the description of an HBase database, you must:
  1. Define and initialize a hbConnection variable.
  2. Use the hbGetTableDescription function.
  3. Retrieve the table description in a hbTableDescription variable. This variable contains an array of hbColumnDescription variables describing the columns.Example:
// Connexion
Connexion is hbConnection
Connexion.Server = "MonServeur"
// Récupération de la description de la table
DescTable is hbTableDescription = hbRécupèreDescriptionTable(connection, "blog")
// Affichage du nom de la table
Trace("table: " + DescTable.Name)
// Affichage de la description des colonnes
FOR EACH DescCol OF DescTable.Column
	Trace(TAB + "colonne: " + DescCol.Nom)
	Trace(TAB + TAB + "attribut: ")
	FOR EACH ValAttribut, NomAttribut of DescCol.Attribut
		Trace(TAB + TAB + NomAttribut + " = " + ValAttribut)
	END
END

How to delete an HBase table?

To delete an HBase table, you must:
  1. Define and initialize a hbConnection variable.
  2. Use hbDeleteTable and specify the name of the table to delete.Example:
// Connection
Connection is hbConnection
Connection.Server = "MyServer"
// Delete the table
hbDeleteTable(Connection, "blog")

How to read the data found in an HBase database?

To read the data found in an HBase database, you must:
  1. Define and initialize a hbConnection variable.
  2. Define and initialize a hbReading variable. This variable contains an array of hbColumn variables describing the columns to retrieve.
  3. Use the hbRead function.
  4. Read data in the hbCell resultExample:
// Connexion
Connexion is hbConnection
Connexion.Serveur = "MonServeur"
// Description des données à lire
Lecture is hbReading
Lecture.Ligne = "post1"
Lecture.Version = 2
// Description colonne
Col is hbColumn
Col.Famille = "Post"
Add(Lecture.Colonne, Col)
// Lecture des données
MonRésultat is array of hbCell = hbLit(connection, "blog", Lecture)
// Affichage des données lues
FOR EACH Cellule OF MonRésultat DO
	Trace("Colonne: " + Cellule.Colonne.Qualificatif + "; Valeur: " + ...
	Cellule.Valeur + "; timestamp: " + Cellule.Timestamp)
END

How to write data into an HBase database?

To write data into an HBase database, you must:
  1. Define and initialize a hbConnection variable.
  2. Define and initialize a hbWriting variable. This variable contains an array of hbCell variables describing the data to write.
  3. Use the hbWrite function.Example:
// Connection
Connection is hbConnection
Connection.Server = "MyServer"
// Description of data to write
Writing is hbWriting
Writing.Row = "post1"
Cell is hbCell
Cell.Column.Family = "post"
Cell.Column.Qualifier = "title"
Cell.Value = "This is my blog post."
Add(Writing.Cell, Cell)
// Write data
hbWrite(Connection, "blog", Writing)

How to delete data from an HBase table?

To delete data from an HBase table, you must:
  1. Define and initialize a hbConnection variable.
  2. Use hbDelete and specify the identifier of the row to delete.Example:
// Connection
Connection is hbConnection
Connection.Server = "MyServer"
// Delete the entire row
hbDelete(Connection, "blog", "post1")

How to perform a browse with filter in an HBase table?

To perform a browse with filter in an HBase database, you must:
  1. Define and initialize a hbConnection variable.
  2. Define and initialize a hbScanParameter variable. This variable defines the filter to implement.
  3. Browse the filtered data (corresponding to the hbScanParameter variable) via the FOR EACH statement. The browse result is read in a hbScanResult variable. Example:
// Connexion
Connexion is hbConnection
Connexion.Server = "MonServeur"
// Description du filtre
MonScan is hbScanParameter
MonScan.Connection = connection
MonScan.Table = "blog"
// Filtre pour toutes les lignes les valeurs des colonnes dont le nom commence par "Titre"
MonScan.Filter = "{ ""type"": ""ColumnPrefixFilter"", ""value"": """ + ...
	Encode("Titre", encodeBASE64) + """ }"
// Parcours selon le filtre et affichage des données filtrées
// La variable de parcours MonRésultat est de type hbRésultatScan
FOR EACH MonRésultat OF MonScan
	Trace("La colonne " + MonRésultat.Colonne.Famille + ":" + ...
		MonRésultat.Colonne.Qualificatif + ...
		" de la ligne " + MonRésultat.Ligne + " vaut " + MonRésultat.Valeur)
END
See also
Minimum version required
  • Version 21
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/30/2024

Send a report | Local help