get_table_context
Read a table's schema, joins, value lists, null shares, and notes from a dbprint snapshot before writing SQL or profiling its data.
Instructions
Read one table. Call it before writing SQL against a table, with purpose: query: DDL, the Joins list (declared foreign keys, joins dbprint inferred from column names or measured from values, and joins a person added, tagged annotated - minus any a person rejected; a join mentioned only in the table's prose description is not in it), a data dictionary, the value lists a predicate is written from, with their counts and coverage, and each nullable column's null share, plus notes that apply to the whole database. Call it with the default purpose: profile to describe the data - statistics such as null rates, cardinality and ranges, joins, the table's prose description and notes. Use search_columns or list_tables first when the table is not yet known, and resolve_value to check how one phrase is spelled in one column. Paged: md and yaml end every page but the last with a next_cursor line, json carries it as a key; a section too long for one page continues on the next, never dropped. Under profile, md Notes summarise each column - a long value list shows its 5 most frequent values - while json and yaml carry the statistics whole; for json/yaml a _corrupted field names any of the table's print files that failed to parse.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Dotted fully-qualified table name, as list_tables and search_columns return it | |
| cursor | No | `next_cursor` from this call's previous page; omit for the first page | |
| format | No | md renders the chosen purpose as Markdown - under `profile`, a per-column Notes summary rather than the raw statistics fields json and yaml carry. All three omit each column's sketch (a hashed summary of its distinct values); the table's raw statistics file, sketch included, is the dbprint://<connection>/<table>/statistics resource. get_reference document: guide explains each json/yaml field. | md |
| purpose | No | query before writing SQL: DDL, the Joins list, data dictionary and the value lists with counts and coverage, and each nullable column's null share, with no other statistics. profile (default) to describe the data: statistics, relationships, notes | profile |
| connection | No | Which database to read, by connection name; needed only when the server serves several, and the error for a missing one lists them. Omit it for the server's default | |
| include_stats | No | Include the Cardinality table (md) or statistics object (json/yaml); no effect under `query`, which carries neither | |
| include_annotations | No | Include the notes and claims people wrote on its columns and values, and notes that apply to the whole database, when written | |
| include_description | No | Include the table's prose description, when one was written | |
| include_relationships | No | Include the Relationships section (md) or relationships object (json/yaml); under `query`, the Joins list |