> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Table Sample Data

> Get, add, and delete sample data for a table

# Table Sample Data

Manage sample data rows for a table. Sample data provides a preview of the table's contents and is useful for data discovery and documentation.

## Get Sample Data

`GET /v1/tables/{id}/sampleData`

**id** `string` *required*

UUID of the table.

## Add Sample Data

`PUT /v1/tables/{id}/sampleData`

**id** `string` *required*

UUID of the table.

**columns** `array` *required*

Array of column names, in the same order as the values in each row.

**rows** `array` *required*

Array of row arrays. Each row is an array of values matching the column order.

## Delete Sample Data

`DELETE /v1/tables/{id}/sampleData`

**id** `string` *required*

UUID of the table.

```python GET /v1/tables/{id}/sampleData theme={null}
from metadata.sdk import configure, client
from metadata.sdk.entities import Tables
from metadata.generated.schema.entity.data.table import TableData

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)

rest = client().ometa.client

table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

# Add sample data
Tables.add_sample_data(table_id, TableData(
    columns=["id", "name", "email", "created_at"],
    rows=[
        [1, "Alice Johnson", "alice@example.com", "2024-01-15T10:30:00Z"],
        [2, "Bob Smith", "bob@example.com", "2024-02-20T14:15:00Z"],
        [3, "Carol Williams", "carol@example.com", "2024-03-10T09:45:00Z"]
    ]
))

# Get sample data
table = Tables.get_sample_data(table_id)
for row in table.sampleData.rows:
    print(row)

# Delete sample data
rest.delete(f"/tables/{table_id}/sampleData")
```

```java GET /v1/tables/{id}/sampleData theme={null}
import java.util.List;
import org.openmetadata.schema.entity.data.Table;
import org.openmetadata.schema.type.TableData;
import org.openmetadata.sdk.network.HttpMethod;

// client is an initialized OpenMetadataClient.

String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";

// Get sample data
Table sample = client.tables().getSampleData(tableId);

// Add sample data
TableData sampleData = new TableData()
    .withColumns(List.of("id", "name", "email", "created_at"))
    .withRows(List.of(
        List.<Object>of(1, "Alice Johnson", "alice@example.com", "2024-01-15T10:30:00Z"),
        List.<Object>of(2, "Bob Smith", "bob@example.com", "2024-02-20T14:15:00Z"),
        List.<Object>of(3, "Carol Williams", "carol@example.com", "2024-03-10T09:45:00Z")
    ));
client.tables().updateSampleData(tableId, sampleData);

// Delete sample data
client.getHttpClient().execute(
    HttpMethod.DELETE,
    "/v1/tables/" + tableId + "/sampleData",
    null,
    Void.class
);
```

```bash GET /v1/tables/{id}/sampleData theme={null}
# Get sample data
curl "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/sampleData" \
  -H "Authorization: Bearer {access_token}"

# Add sample data
curl -X PUT "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/sampleData" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "columns": ["agent_id", "performance_score"],
    "rows": [
      ["AGT-001", 92.5],
      ["AGT-002", 87.3],
      ["AGT-003", 95.1]
    ]
  }'

# Delete sample data
curl -X DELETE "{base_url}/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3/sampleData" \
  -H "Authorization: Bearer {access_token}"
```

```json Response (Get Sample Data) theme={null}
{
  "id": "455e3d9d-dbbf-455e-b3be-7191daa825f3",
  "name": "agent_performance",
  "sampleData": {
    "columns": ["agent_id", "performance_score"],
    "rows": [
      ["AGT-001", 92.5],
      ["AGT-002", 87.3],
      ["AGT-003", 95.1]
    ]
  }
}
```

***

## Returns

**Get** returns the table. The sample data is in its `sampleData` field, with `columns` and `rows` arrays.

**Add** returns the updated table.

**Delete** returns the updated table, without sample data.

## Response

**columns** `array`

Array of column names for the sample data. This field is inside `sampleData`.

**rows** `array`

Array of row arrays. Each row contains values in the same order as the columns.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission |
| `404` | `NOT_FOUND` | Table does not exist or has no sample data |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.