ADO.NET Provider for Apache HBase

Build 21.0.7930

UPSERT Statements

An UPSERT statement updates an existing record or creates a new record if an existing record is not identified.


The UPSERT syntax is the same as for insert. Apache HBase uses the input provided in the VALUES clause to determine whether the record already exists. If the record does not exist, all columns required to insert the record must be specified. See Data Model for any table-specific information.

UPSERT INTO <table_name> 
( <column_reference> [ , ... ] )
( { <expression> | NULL } [ , ... ] ) 

<expression> ::=
  | @ <parameter> 
  | ?
  | <literal>

You can use the ExecuteNonQuery method to issue data manipulation commands and retrieve the rows affected, as shown in the following example:


String connectionString = "Server=;Port=8080;";
int rowsAffected;
using (ApacheHBaseConnection connection = new ApacheHBaseConnection(connectionString)) {
  ApacheHBaseCommand cmd = new ApacheHBaseCommand("UPSERT INTO Account (Name) VALUES ('Floppy Disks')", connection);
  rowsAffected = cmd.ExecuteNonQuery();


Dim connectionString As [String] = "Server=;Port=8080;"
Dim rowsAffected As [Integer]
Using connection As New ApacheHBaseConnection(connectionString)
  Dim cmd As New ApacheHBaseCommand("UPSERT INTO Account (Name) VALUES ('Floppy Disks')", connection)
  rowsAffected = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7930