Skip to main content

Get Table Sample Data

Retrieve random sample rows from a table.

Endpoint: /openapi/v1/metadata/table/sampleData

Method: GET

Request parameters

ParameterTypeRequiredDescriptionExample
datasourceIdStringYesData source ID. Call Retrieve Data Source List to get the value.ds-d92qvqp8o1fw
databaseNameStringYesDatabase name. Call Get Database List to get the value.9zcloud
schemaNameStringNoSchema name. Call Get Schema List to get the value.public
tableNameStringYesTable name. Call Get Table List to get the value.pgbench_accounts
countIntegerNoNumber of rows to sample. The default is 10. To control response size, use 1100.1

Response parameters

ParameterTypeDescriptionExample
successBoolWhether the call succeeded. Values: true or false.true
requestIdStringRequest ID.Gd3g8OGL-jpmmjRSnkqit5HAdjmb6IMV
dataArraySampled 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.

ParameterTypeDescriptionExample
[columnName1]StringA target-table column name used as an object key.id
[columnValue1]Matches the column definitionThe value of the corresponding column.93
[columnName2]StringAnother target-table column name.name
[columnValue2]Matches the column definitionThe 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
}
]
}