All Products
Search
Document Center

Lindorm:Use the ApsaraDB for HBase API for a non-Java language to develop applications

Last Updated:Jun 20, 2026

The Lindorm wide table engine lets you connect using the HBase non-Java API in languages like C++, Python, and Go. This topic describes how.

Prerequisites

  • You have downloaded the Thrift installation package.

  • You have downloaded the HBase Thrift2 definition file.

  • You have obtained the endpoint for Access by Using HBase non-Java API for LindormTable. For more information, see View endpoints. Log on to the Lindorm console. On the instance details page, select the Wide Table Engine tab, expand the HBase-compatible Endpoints section, and then obtain the endpoint for a Virtual Private Cloud (VPC) or the public network in the HBase non-Java API section. The port number is 9190.

Use the ApsaraDB for HBase API for a non-Java language, such as Python, to connect to LindormTable

For more information about how to use the Thrift installation package, see the Apache Thrift official documentation. To access the Lindorm wide table engine using Thrift, follow these steps:

  1. Execute the following statement to use the Thrift2 definition file for ApsaraDB for HBase to generate an interface definition language (IDL) file in the corresponding language:

    thrift --gen <language> Hbase.thrift
    Note

    The language placeholder represents your target programming language, for example, python, php, cpp, or py.

    Sample statement:

    thrift --gen py Hbase.thrift
  2. Create a client to access the Lindorm wide table engine.

    The Thrift server in Lindorm uses HTTP in the transport layer. The ThttpClient of Thrift is required when you create a client. The method of creating the client varies based on the languages. If the Access Control List (ACL) is enabled, specify the username and password in two headers in the ThttpClient for authentication. The username and password are not required if ACL is disabled. Thrift allows you to call a function for a language to specify a custom header in ThttpClient. In the following example, Python is used. You can execute the following statements to create a client and connect to LindormTable:

     # -*- coding: utf-8  -*-
     # The following two modules are generated by running the 'pip install thrift' command.
     from thrift.protocol import TBinaryProtocol
     from thrift.transport import THttpClient
     # The following two modules are generated by running the 'thrift --gen py hbase.thrift' command.
     from hbase import THBaseService
     from hbase.ttypes import TColumnValue, TColumn, TTableName, TTableDescriptor, TColumnFamilyDescriptor, TNamespaceDescriptor, TGet, TPut, TScan
     # Configure the endpoint for the Lindorm wide table engine.
     url = "http://ld-bp17j28j2y7pm****-proxy-lindorm.lindorm.rds.aliyuncs.com:9190"
     transport = THttpClient.THttpClient(url)
     headers = {}
     # Set the username.
     headers["ACCESSKEYID"]="testuser";
     # Set the password that corresponds to the username.
     headers["ACCESSSIGNATURE"]="password"
     transport.setCustomHeaders(headers)
     protocol = TBinaryProtocol.TBinaryProtocolAccelerated(transport)
     client = THBaseService.Client(protocol)
     transport.open()
     # Close the connection after the operations are complete.
     transport.close()

Sample code in other languages

To obtain complete sample code for other non-Java languages, click one of the following download links to download sample code for a language from GitHub: