yggdrasil.arrow.display¶
display ¶
Render an Arrow table as an aligned, typed text preview.
:func:arrow_display is the engine behind
:meth:yggdrasil.io.tabular.Tabular.display — give it a
pa.Table (and, optionally, the project :class:~yggdrasil.data.schema.Schema
that carries the column markers) and it lays out a first-n-rows preview:
- a two-row header — the column names, then each column's short type tag
(:meth:
yggdrasil.data.types.base.DataType.short, recursive for nested types) plus its main schema markers (PK / partition / required); - a
│-delimited body with a─┼─rule under the header and a─┴─rule to close; numbers / booleans right-align; - every cell clipped to max_width (headers a touch wider) and measured by display width — combining marks count 0, East-Asian wide / emoji glyphs count 2 — so CJK / accented values line up on what the terminal shows and one long value can never balloon the table.
It reads the Arrow columns directly (no per-row dicts): one pass per column
builds [name, type, *values], the width is the widest cell each column
must fit, then the grid is stitched row by row.
arrow_display ¶
arrow_display(
table: Table,
schema: Schema | None = None,
*,
n: int = 10,
max_width: int = 32
) -> str
Render table's first n rows as an aligned, typed text table.
schema supplies the per-column type tags and markers; when omitted it is
derived from table.schema. A table holding more than n rows shows a
… (first n rows) marker; otherwise the footer is the shape.
print(arrow_display(some_table, n=5))