get_sample_data
Retrieve representative sample rows from a database table using configurable sampling methods (top, tablesample, modulo). Returns token-efficient results with automatic truncation of large text and binary data.
Instructions
Retrieve sample data from a table.
Returns representative sample rows from a table with support for multiple sampling strategies. Automatically truncates large text (>1000 chars) and binary data (shows first 32 bytes as hex) to keep responses token-efficient.
Args: connection_id: Connection ID from connect_database table_name: Name of the table. May be dotted (e.g. 'schema.table' or 'catalog.schema.table') and is resolved against the dialect. schema_name: Schema name. Defaults to the dialect's default schema (e.g. 'dbo' on MSSQL) when omitted. sample_size: Number of rows to return, 1-1000 (default: 5) sampling_method: Sampling strategy - 'top', 'tablesample', or 'modulo' (default: 'top') - 'top': Fast SELECT TOP N (not representative, just first N rows) - 'tablesample': SQL Server statistical sampling (more representative) - 'modulo': Deterministic sampling using modulo on row number (repeatable) columns: Optional list of column names to include (default: all columns) catalog: Optional Databricks catalog name. Rejected on non-Databricks dialects (returns an error response).
Returns: TOON-encoded string with sample rows and metadata:
status: "success" | "error"
sample_id: string // on success only
table_id: string // on success only
sample_size: int // on success only
actual_rows_returned: int // on success only
sampling_method: "top" | "tablesample" | "modulo" // on success only
rows: list of object // on success only
truncated_columns: list of string // on success only
sampled_at: ISO 8601 string // on success only
error_message: string // on error only
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog | No | ||
| columns | No | ||
| table_name | Yes | ||
| sample_size | No | ||
| schema_name | No | ||
| connection_id | Yes | ||
| sampling_method | No | top |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |