You always need to query a data record in Lindorm when you develop, debug, or maintain
your services. You can use Lindorm Shell to create Get and Scan queries. You can also
use the easy-to-use SQL query interface in Lindorm Insight to query data. In the interface,
you can use the SQL syntax to query Lindorm tables.
Notes
Before you run an SQL query, make sure that you have read and understand the following
notes to efficiently solve the issues or the questions you may encounter:
- The system supports only SELECT statements. If you need to modify data, use the command-line interface or use the
ApsaraDB for HBase API to develop an application.
- To ensure data security, the system returns a maximum of 100 data records for each
query.
- To query varbinary fields based on conditions, you must use hexadecimal strings as values.
- The ROW field corresponds to the rowkey in ApsaraDB for HBase. The ROW and qualifier fields are of the varbinary data type. If the qualifier does not belong to the family, you must specify the family, such as
select 'ROW', q1, 'f1:q2' from...
.
- ROW and COL are SQL reserved words. Therefore, you must use backticks to enclose them in your
queries. When you specify a family for a qualifier, you must also use backticks to enclose the family.
Procedure
You can use the
SQL query page in Lindorm Insight to go to the data query system. Before you run a query, you
must select the namespace where the tables that you want to query are stored. After
you select the namespace, all the tables in the namespace are displayed in a tree
structure on the right side of the page. You can click the name of a table to view
the schema of the table. ROW represents RowKey and COL is the preconfigured column
name. You can create SELECT query requests based on the table schema.
Note The SQL query page in Lindorm Insight does not support the use namespace syntax. To
specify or change a namespace for your query, you must select the namespace from the
namespace list in the upper-left corner of the SQL query page.
- Log on to the Lindorm Insight system. For more information, see Log on to Lindorm Insight.
- In the left-side navigation pane, click Data Query.
- On the SQL query page, select a namespace from the corresponding drop-down list. All the tables in
the selected namespace are displayed on the right side of the page. Then, edit SQL
query statements based on the information about these tables and click execute.
Convert binary strings to hexadecimal strings
In Lindorm, data is stored in the byte[]
format. In the query results on the SQL query page, the values of varbinary
fields are displayed in the Lindorm BinaryString coding format.
If you query varbinary
fields based on conditions, you use a where
clause that contains rowkey
or other fields in your query statement. In this case, you must specify the values
in the query conditions as hexadecimal strings. For example, to query data where the rowkey
is r1
, the where
clause in the SQL query must be where rowkey='7321'
. In this example, the hexadecimal value of the r1
string is 7321
.
To help you convert binary strings to hexadecimal strings for your queries in an easy
manner, Lindorm Insight provides an easy-to-use converter on the
SQL query page. You need only to enter your
binary string into the text box. Then, the corresponding
hexadecimal string is displayed in the SQL editor, as shown in the following figure.

If you need to view the query results that are displayed as
hexadecimal strings, select the
HexString check box. Then, the system converts the values of the
varbinary fields in the query results to
hexadecimal strings, as shown in the following figure.
