from metadata.sdk import configure
from metadata.sdk.entities import Tables
configure(
host="https://your-company.getcollate.io/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", "[email protected]", "2024-01-15T10:30:00Z"],
[2, "Bob Smith", "[email protected]", "2024-02-20T14:15:00Z"],
[3, "Carol Williams", "[email protected]", "2024-03-10T09:45:00Z"]
]
})
# Delete sample data
Tables.delete_sample_data(table_id)