Table Store is a NoSQL database service built on Alibaba Cloud's Apsra distributed operating system.

Procedure

  1. Choose Data Sources > Add Source.
  2. From the Type drop-down menu, select TableStore.
  3. Enter the Table Store data source information, as shown in the following figure.

    • Name: The display name of the data source. You can customize the display name as needed.
    • AK ID: The AccessKey ID of the account that can access Table Store.
    • AK Secret: The AccessKey Secret of the account that can access Table Store.
    • Internet: The endpoint of Table Store. You can enter an endpoint according to the Table Store instance to be accessed.

    The system automatically tests connectivity after the data source information is set.

  4. After the connectivity test is successful, click OK.

    The data source is automatically displayed in the data source list.

Use the Table Store data source

  1. In the DataV console, click Projects, select the target project, and click Edit.
  2. On the displayed page, select a widget. In the data pane, select TableStore for Data Source Type.
  3. From the Select Data Source drop-down menu, select the Table Store data source you have configured before.
  4. From the Select Action drop-down menu, select either of the following actions:
    • getRow: Corresponds to the GetRow API of Table Store. For more information, see GetRow API.
    • getRange: Corresponds to the GetRange API of Table Store. For more information, see GetRange API.
  5. In the Select Action area, enter a SQL statement. The SQL statement must meet the following requirements:
    • Parameters in the SQL statement must be in the JSON format.
    • If you select getRow, the system reads data from a row according to the specified primary key.
      The following is an example of the parameter format:
      
      {
      "table_name": "test",
      "rows": {
      "id": 2
      },
      "columns": [
      "id",
      "test"
      ]
      }
      The parameters in the SQL statement:
      • table_name: The name of the table to be queried.
      • rows: The conditions for filtering a row. Only the rows that meet the conditions are displayed. To add a column as a condition, you must create an index for the column first.
      • columns: The name of columns to be displayed.
    • The getRange action is used to read data with specified primary keys. The parameter format is as follows:
      
      {
      "table_name": "test",
      "direction": "FORWARD",
      "columns": [
      "id",
      "test"
      ],
      "range": {
      "limit": 4,
      "start": {
      "id": "InfMin"
      },
      "end": {
      "id": 3
      }
      }
      }
      • table_name: The name of the table to be queried.
      • direction: The query sequence.
      • columns: The name of the column to be displayed.
      • limit: The maximum number of rows to be displayed.
      • start: The start column in the displayed result. You must create indexes for the relevant columns.
      • end: The end column in the displayed result. You must create indexes for the relevant columns.
      Note You can use InfMin and InfMax to indicate the minimum and maximum values of the start and end parameters.
  6. Click View Data Response to view the effect.

Example

  1. Prepare data for the Table Store data source.

     Log on to the Table Store console, create an instance, and read or write data. In the following example, an instance named test1948 is created. This instance has three rows of data and each row has two columns named id (primary key in integer format) and test (in string format).



  2. Configure the data source, as shown in the following figure.

  3. Query parameters.
    • getRow:

      The data response is as follows.

    • getRange:

      The data response is as follows.

    Note When you query the getRange parameter, if you set start to id:InfMin and end to id:3, the values 1 and 2 are displayed for id. The reason for this is that the getRange parameter does not contain the end row, whose id is 3, because it is not within the range specified.