flowserv.client.cli.table module

Helper methods and classes for the command line interface.

class flowserv.client.cli.table.ResultTable(headline, types)

Bases: object

Result table for database queries. Maintains a list or result rows. Provides functionality to format rows for printing.

add(row)

Add a row to the table. The length of the row is expected to be the same as the length of the table headline. That is, the row contains one per column in the table.

Parameters

row (list(string)) – List of column values

format()

Format the table rows in tabular format. Each rows is a list of string values. All rows are expected to have the same length. The first row is the header that contains the column names.

Return type

list(string)

flowserv.client.cli.table.align(type_id)

Get align identifier depending on the data type. Numeric types are right aligned. All other types are left aligned.

type_id: string

Type identifier (from set of valid type identifier in parameter declarations)

Return type

string

flowserv.client.cli.table.format_row(row, column_size, types)

Format the given row. Row values are padded using the given list of column widths.

Parameters
  • row (list(string)) – List of cell values in a table row

  • column_size (list(int)) – List of column widths

  • types (list(string)) – List of column type identifier

Return type

string