GET /v1/tables/{id}/sampleData
from metadata.sdk import configure
from metadata.sdk.entities import Tables
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Get sample data
sample = Tables.get_sample_data(table_id)
for row in sample.get("rows", []):
print(row)
# Add sample data
Tables.add_sample_data(table_id, {
"columns": [
{"name": "id", "dataType": "INT"},
{"name": "name", "dataType": "VARCHAR"},
{"name": "email", "dataType": "VARCHAR"},
{"name": "created_at", "dataType": "TIMESTAMP"}
],
"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"]
]
})
# Delete sample data
Tables.delete_sample_data(table_id)
import static org.openmetadata.sdk.fluent.Tables.*;
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Get sample data
var sample = Tables.getSampleData(tableId);
// Add sample data
Tables.addSampleData(tableId, Map.of(
"columns", List.of(
Map.of("name", "id", "dataType", "INT"),
Map.of("name", "name", "dataType", "VARCHAR"),
Map.of("name", "email", "dataType", "VARCHAR"),
Map.of("name", "created_at", "dataType", "TIMESTAMP")
),
"rows", List.of(
List.of(1, "Alice Johnson", "alice@example.com", "2024-01-15T10:30:00Z"),
List.of(2, "Bob Smith", "bob@example.com", "2024-02-20T14:15:00Z"),
List.of(3, "Carol Williams", "carol@example.com", "2024-03-10T09:45:00Z")
)
));
// Delete sample data
Tables.deleteSampleData(tableId);
# 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": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"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}"
{
"columns": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"rows": [
["AGT-001", 92.5],
["AGT-002", 87.3],
["AGT-003", 95.1]
]
}
Table Sample Data
Get, add, and delete sample data for a table
GET
/
v1
/
tables
/
{id}
/
sampleData
GET /v1/tables/{id}/sampleData
from metadata.sdk import configure
from metadata.sdk.entities import Tables
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Get sample data
sample = Tables.get_sample_data(table_id)
for row in sample.get("rows", []):
print(row)
# Add sample data
Tables.add_sample_data(table_id, {
"columns": [
{"name": "id", "dataType": "INT"},
{"name": "name", "dataType": "VARCHAR"},
{"name": "email", "dataType": "VARCHAR"},
{"name": "created_at", "dataType": "TIMESTAMP"}
],
"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"]
]
})
# Delete sample data
Tables.delete_sample_data(table_id)
import static org.openmetadata.sdk.fluent.Tables.*;
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Get sample data
var sample = Tables.getSampleData(tableId);
// Add sample data
Tables.addSampleData(tableId, Map.of(
"columns", List.of(
Map.of("name", "id", "dataType", "INT"),
Map.of("name", "name", "dataType", "VARCHAR"),
Map.of("name", "email", "dataType", "VARCHAR"),
Map.of("name", "created_at", "dataType", "TIMESTAMP")
),
"rows", List.of(
List.of(1, "Alice Johnson", "alice@example.com", "2024-01-15T10:30:00Z"),
List.of(2, "Bob Smith", "bob@example.com", "2024-02-20T14:15:00Z"),
List.of(3, "Carol Williams", "carol@example.com", "2024-03-10T09:45:00Z")
)
));
// Delete sample data
Tables.deleteSampleData(tableId);
# 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": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"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}"
{
"columns": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"rows": [
["AGT-001", 92.5],
["AGT-002", 87.3],
["AGT-003", 95.1]
]
}
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
UUID of the table.
Add Sample Data
PUT /v1/tables/{id}/sampleData
UUID of the table.
Array of row arrays. Each row is an array of values matching the column order.
Delete Sample Data
DELETE /v1/tables/{id}/sampleData
UUID of the table.
GET /v1/tables/{id}/sampleData
from metadata.sdk import configure
from metadata.sdk.entities import Tables
configure(
host="https://your-company.open-metadata.org/api",
jwt_token="your-jwt-token"
)
table_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
# Get sample data
sample = Tables.get_sample_data(table_id)
for row in sample.get("rows", []):
print(row)
# Add sample data
Tables.add_sample_data(table_id, {
"columns": [
{"name": "id", "dataType": "INT"},
{"name": "name", "dataType": "VARCHAR"},
{"name": "email", "dataType": "VARCHAR"},
{"name": "created_at", "dataType": "TIMESTAMP"}
],
"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"]
]
})
# Delete sample data
Tables.delete_sample_data(table_id)
import static org.openmetadata.sdk.fluent.Tables.*;
String tableId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890";
// Get sample data
var sample = Tables.getSampleData(tableId);
// Add sample data
Tables.addSampleData(tableId, Map.of(
"columns", List.of(
Map.of("name", "id", "dataType", "INT"),
Map.of("name", "name", "dataType", "VARCHAR"),
Map.of("name", "email", "dataType", "VARCHAR"),
Map.of("name", "created_at", "dataType", "TIMESTAMP")
),
"rows", List.of(
List.of(1, "Alice Johnson", "alice@example.com", "2024-01-15T10:30:00Z"),
List.of(2, "Bob Smith", "bob@example.com", "2024-02-20T14:15:00Z"),
List.of(3, "Carol Williams", "carol@example.com", "2024-03-10T09:45:00Z")
)
));
// Delete sample data
Tables.deleteSampleData(tableId);
# 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": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"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}"
{
"columns": [
{"name": "agent_id", "dataType": "VARCHAR"},
{"name": "performance_score", "dataType": "DECIMAL"}
],
"rows": [
["AGT-001", 92.5],
["AGT-002", 87.3],
["AGT-003", 95.1]
]
}
Returns
Get returns the sample data object with columns and rows arrays. Add returns the updated sample data object. Delete returns no content (204).Response
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 |
Was this page helpful?
⌘I