Add a Tablestore data source to DataV and use it to query table data with the getRow or getRange operation.
Prerequisites
You have a Tablestore data source available.
Add a Tablestore data source
Log on to the DataV console.
On the My Data tab, select Data Source Management and click Add Data.
-
From the Type list, select TableStore.
-
Configure the following Tablestore parameters.
Parameter
Description
Name
The display name of the data source. You can enter any name.
AK ID
The AccessKey ID of the account that can access Tablestore.
AK Secret
The AccessKey secret of the account that can access Tablestore.
Public network
The endpoint of your Tablestore instance. Enter the endpoint based on the Tablestore instance that you want to access. Endpoints.
-
Click OK.
The data source appears in the data source list.
Use a Tablestore data source
Log on to the DataV console.
-
On the My Visualization page, hover the pointer over the visualization application that you want to edit, and then click Edit.
ImportantIf no visualization applications exist on the My Visualization page, create one. Create a PC visualization application using a template.
-
On the canvas editor page, click a widget on the canvas.
If the canvas has no widgets, add one. Add an asset.
-
In the right-side configuration panel, click the Data tab, and then click Configure Data Source.
-
On the Set Data Source page, set Data Source Type to TableStore.
-
From the Select Existing Data Source list, select your Tablestore data source.
-
From the Select Operation list, select an operation.
Supported operations:
-
getRow: Corresponds to the Tablestore GetRow API. the GetRow API Reference. -
getRange: Corresponds to the Tablestore GetRange API. the GetRange API Reference.
-
-
In the Select Operation box, enter a query statement in JSON format.
-
The query parameter must be a JSON object.
-
If you select
getRow, you can read a single row by primary key.Parameter format:
{ "table_name": "test", "rows": { "id": "1" }, "columns": [ "id", "test" ] }Parameter
Description
table_name
The Tablestore table to query.
rows
The primary key of the row to read.
ImportantIf the table has multiple primary key columns, the number and data types of the columns that you set must match those of the table.
columns
The columns to return.
-
If you select
getRange, you can read data within a specified primary key range. Parameter format:{ "table_name": "test", "direction": "FORWARD", "columns": [ "id", "test" ], "range": { "limit": 4, "start": { "id": "InfMin" }, "end": { "id": "3" } } }Parameter
Description
table_name
The Tablestore table to query.
direction
The read direction.
-
FORWARD: The start primary key must be smaller than the end primary key. Rows are returned in ascending order.
-
BACKWARD: The start primary key must be larger than the end primary key. Rows are returned in descending order.
Example: A table has two primary keys A and B where A < B. A FORWARD read of [A, B) returns rows with primary keys >= A and < B, sorted from A to B. A BACKWARD read of [B, A) returns rows with primary keys > A and <= B, sorted from B to A.
columns
The columns to read. Can be primary key columns or attribute columns.
If not specified, all columns are returned.
Rows within the range that do not contain the specified columns are excluded from the result.
limit
The maximum number of rows to return. Must be greater than 0.
The operation stops after returning this many rows, even if more data exists in the range.
start
The start and end primary keys for the range read. Both must be valid primary keys or virtual points of InfMin and InfMax types. The number of columns must match the table schema.
InfMin represents negative infinity and is smaller than any other value. InfMax represents positive infinity and is larger than any other value.
ImportantThe number and data types of primary key columns must match the table schema.
-
start: The start primary key (inclusive).
-
end: The end primary key (exclusive).
end
-
-
-
Click Preview Data Source Response to verify the query result.
Example
-
Prepare the Tablestore data.
-
Log on to the Tablestore console.
-
Create a Tablestore instance and a data table. Create an instance and Create a data table.
The following example uses an instance named test with a data table containing three rows. Each row has two columns:
id(primary key, integer) andtest(string).
-
-
Configure the data source.
-
Query parameter
-
Query data using the
getRowmethod.
Data response:

-
Query data using the
getRangemethod.
Data response:

NoteWhen you use getRange with start set to id:InfMin and end set to id:3, two records are returned with id values 1 and 2. The row where id is 3 is excluded because the getRange end key specified by end is exclusive.
-