Get Table Sample Data
Retrieve random sample rows from a table.
Endpoint: /openapi/v1/metadata/table/sampleData
Method: GET
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
datasourceId | String | Yes | Data source ID. Call Retrieve Data Source List to get the value. | ds-d92qvqp8o1fw |
databaseName | String | Yes | Database name. Call Get Database List to get the value. | 9zcloud |
schemaName | String | No | Schema name. Call Get Schema List to get the value. | public |
tableName | String | Yes | Table name. Call Get Table List to get the value. | pgbench_accounts |
count | Integer | No | Number of rows to sample. The default is 10. To control response size, use 1–100. | 1 |
Response parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
success | Bool | Whether the call succeeded. Values: true or false. | true |
requestId | String | Request ID. | Gd3g8OGL-jpmmjRSnkqit5HAdjmb6IMV |
data | Array | Sampled rows, including column names and values. | {"id":93} |
Sample row details
The field names and number of fields in each object in data depend on the target table schema.
| Parameter | Type | Description | Example |
|---|---|---|---|
[columnName1] | String | A target-table column name used as an object key. | id |
[columnValue1] | Matches the column definition | The value of the corresponding column. | 93 |
[columnName2] | String | Another target-table column name. | name |
[columnValue2] | Matches the column definition | The value of the corresponding column. | example |
... | — | Other columns follow the same pattern. | — |
Successful response
{
"success": true,
"requestId": "Gd3g8OGL-jpmmjRSnkqit5HAdjmb6IMV",
"data": [
{
"vv": 108,
"dt": "2023-12-19 15:07:55Z",
"ii": 100,
"id_gen_stored": 94,
"v": "meidong",
"id": 93,
"col2": 1,
"col0": 1,
"dbl": 100.0,
"col1": 10
}
]
}