sqlcompyre.report.formatters package

Submodules

Module contents

Formatters for rendering reports.

class sqlcompyre.report.formatters.Formatter[source]

Bases: ABC

Abstract base class for formatters of reports.

Attributes:
file_extension

The file extension to use when this formatter’s output is written to a file.

Methods

format(metadata, sections[, ...])

Format the metadata and the sections from a report.

abstract property file_extension: str

The file extension to use when this formatter’s output is written to a file.

abstract format(metadata: Metadata, sections: list[Section], hide_matching_columns: bool = False) str[source]

Format the metadata and the sections from a report.

Returns:

The formatted string describing the metadata and all sections.

class sqlcompyre.report.formatters.TerminalFormatter(colored: bool = True)[source]

Bases: Formatter

Formatter for printing reports to the terminal.

Attributes:
file_extension

The file extension to use when this formatter’s output is written to a file.

Methods

format(metadata, sections[, ...])

Format the metadata and the sections from a report.

property file_extension: str

The file extension to use when this formatter’s output is written to a file.

format(metadata: Metadata, sections: list[Section], hide_matching_columns: bool = False) str[source]

Format the metadata and the sections from a report.

Returns:

The formatted string describing the metadata and all sections.

class sqlcompyre.report.formatters.TextFormatter[source]

Bases: TerminalFormatter

Formatter for rendering reports as text (= non-colored terminal formatting).

Attributes:
file_extension

The file extension to use when this formatter’s output is written to a file.

Methods

format(metadata, sections[, ...])

Format the metadata and the sections from a report.

sqlcompyre.report.formatters.get_formatter(name: str) Formatter[source]

Get the formatter for the specified identifier.

Args:

name: The identifier of the formatter.

Returns:

The initialized formatter.

Raises:

ValueError: If no formatter for the given identifier can be found.