After you add a Tablestore data source in the DataV console, you can use DataV to display Tablestore data.

Prerequisites

Background information

DataV can convert statistic data to a variety of dynamic visualization charts. For more information, see What is DataV?.

After you add a Tablestore data source to DataV, DataV displays real-time data on a dashboard based on the data of Tablestore tables.

Usage notes

The data source can only be a data table or a secondary index in Tablestore.

Step 1: Add a Tablestore data source

  1. Log on to the DataV console.
  2. On the Data Sources tab, click Data Sources.
  3. On the Data Sources page, click Add Source.
    fig_adddata
  4. In the Add Data Source dialog box, select TableStore from the Type drop-down list. Then, configure other parameters for a Tablestore data source. The following table describes the parameters that you can configure for a Tablestore data source.
    Parameter Description
    Name The display name of the data source.
    AK ID The AccessKey ID of your Alibaba Cloud account or a RAM user that has permissions to access Tablestore.
    AK Secret The AccessKey secret of your Alibaba Cloud account or a RAM user that has permissions to access Tablestore.
    Internet The endpoint of the Tablestore instance. Configure this parameter based on the Tablestore instance that you want to access. For more information, see Endpoint.
  5. Click OK.
    The data source that you added is displayed in the data source list.

Step 2: Configure the Tablestore data source

  1. Log on to the DataV console.
  2. Create a visualization project or select an existing visualization project based on your business scenario.
    • If you use an existing visualization project, move the pointer over the visualization project and click Edit. fig_20220425_datavproject
    • If this is the first time that you use DataV or existing visualization projects do not meet your requirements, you can create visualization projects based on your business requirements.
      Note You can create visualization projects on a PC or mobile device, or by using image recognition. The following procedure describes how to create a visualization project on a PC.
      1. On the Projects tab, click PC Creation.
      2. Move the pointer over the visualization application for which you want to create a project and click Create Project.

        DataV allows you to create a visualization application by using a template or a blank canvas. You can select a method to create a visualization application based on your business requirements.

      3. In the Create New Project dialog box, specify the name of the project and select a group to which the project belongs.
      4. Click Create. fig_20220424_createproject
  3. Configure the Tablestore data source.
    1. On the canvas editing page, click a widget on the canvas.
      Note If no widget exists on the canvas, add a widget first. For more information, see Add a widget.
    2. In the right-side widget configurations panel of the canvas, click the fig_data icon.
    3. On the Data tab, click Set.
      fig_datasource11
    4. Set the Data Source Type parameter to TableStore and select an existing data source.
    5. Select an operation that you want to perform on the data source and enter a query statement.
      Tablestore supports getRow and getRange. getRow corresponds to the GetRow operation in Tablestore. getRange corresponds to the GetRange operation in Tablestore.
      • If you select getRow, a row whose primary key is specified is read. The following code and table describe the format that you can use and the parameters that you can configure for a query statement.
        {
        "table_name": "test",
        "rows": {
        "id": 2
        },
        "columns": [
        "id",
        "test"
        ]
        }
        Parameter Description
        table_name The name of the table in Tablestore.
        rows The primary key of the row.
        Notice You must specify the same number and data types of primary key columns for each row as the number and data types of primary key columns in the table.
        columns The columns that you want to read. You can specify the names of primary key columns or attribute columns.

        If you do not specify a column name, all data in the row is returned.

      • If you select getRange, all data whose primary keys are within a specified range is read. The following code and table describe the format that you can use and the parameters that you can configure for a query statement.
        {
        "table_name": "test",
        "direction": "FORWARD",
        "columns": [
        "id",
        "test"
        ],
        "range": {
        "limit": 4,
        "start": {
        "id": "InfMin"
        },
        "end": {
        "id": 3
        }
        }
        }
        Parameter Description
        table_name The name of the table in Tablestore.
        direction The direction in which data is read.
        • If you set this parameter to FORWARD, specify a smaller value for the start primary key than the value of the end primary key. The returned rows are sorted in ascending order based on their primary key values.
        • If you set this parameter to BACKWARD, specify a greater value for the start primary key than the value of the end primary key. The returned rows are sorted in descending order based on their primary key values.

        For example, if you set the direction parameter to FORWARD for a table that contains two primary keys A and B and the value of A is smaller than the value of B, the rows whose primary key values are greater than or equal to the value of A but smaller than the value of B are returned in ascending order from A to B. If you set the direction parameter to BACKWARD, the rows whose primary key values are smaller than or equal to the value of B and greater than the value of A are returned in descending order from B to A.

        columns The columns that you want to read. You can specify the names of primary key columns or attribute columns.

        If you do not specify a column name, all data in the row is returned.

        If a row is within the specified range to be read based on the primary key value but does not contain the specified columns to return, the response excludes the row.

        limit The maximum number of rows that you want to return. The value of this parameter must be greater than 0.

        An operation stops after the maximum number of rows that you want to return in the forward or backward direction is reached, even if some rows within the specified range are not returned.

        start The start and end primary keys of the range to read. The start and end primary keys must be valid primary keys or virtual points that consist of the InfMin and InfMax type data. The number of columns for each virtual point must be the same as the number of columns of each primary key.

        InfMin indicates an infinitely small value. All values of other types are greater than the InfMin type value. InfMax indicates an infinitely great value. All values of other types are smaller than the InfMax type value.

        Notice You must specify the same number and data types of primary key columns for each row as the number and data types of primary key columns in the table.
        • start indicates the start primary key. If the row that contains the start primary key exists, the row of data is returned.
        • end indicates the end primary key. No matter whether the row that contains the end primary key exists, the row of data is not returned.
        end
    6. Click the refresh icon next to Data Response Result to obtain the response.
      Note After you obtain the response, you can click Preview Data Response to view the response.
  4. Preview and publish a project
    1. In the upper-right corner of Canvas Editor, click the yulan icon to preview the project.
    2. In the upper-right corner of Canvas Editor, click the fabu icon.
    3. In the Publish dialog box, click Publish Project.
    4. In the Publish Success message, click Cancel.
      Note After the project is published, the content on the publish page is locked. After you edit the content, you can synchronize the published content by using the snapshot management feature. You can also click Goto Snapshot Management to view information about snapshots that are created.
    5. Click the figcopy icon on the right side of the URL in the Project URL section.
    6. Copy and paste the URL to the address bar of a browser to view the published project.