render#

dscat.output.render(rows, fmt=Format.table, *, max_col_width=60)[source]#

Render records in the requested format.

Parameters:
  • rows (collections.abc.Sequence of collections.abc.Mapping) – The records to render. Every mapping shares the same keys, which become the columns in their declared order.

  • fmt (dscat.output.Format, default Format.table) – The output format.

  • max_col_width (int or None, default 60) – For the table and markdown formats, collapse each cell to one line and truncate it to this many characters (None leaves cells untouched). The csv, tsv, and json formats always keep the full values.

Returns:

The rendered text, without a trailing newline. Empty rows renders to "[]" for JSON and to the empty string for every other format.

Return type:

str