sqlcompyre.report.writers package

Submodules

Module contents

Writers for outputting sets of reports to a destination.

class sqlcompyre.report.writers.FileWriter(formatter: Formatter)[source]

Bases: Writer

Writer that outputs reports to a set of files.

The files are written to the .compyre directory which is created if it does not yet exist. Each report is then written to a dedicated file in that directory: the name of each file is the report’s identifier and the extension is set to the formatter’s configured file extension.

Methods

write(reports[, hide_matching_columns])

Write the provided reports to this writer's sink.

write(reports: dict[str, Report], hide_matching_columns: bool = False) None[source]

Write the provided reports to this writer’s sink.

Args:

reports: A set of reports, mapped from an identifier to the report. hide_matching_columns: Whether to hide columns from the report which show a perfect

(i.e. 100%) match rate.

class sqlcompyre.report.writers.MarkdownWriter(formatter: Formatter)[source]

Bases: Writer

Writer that outputs reports to standard output as Markdown.

This writer is especially useful for printing comparisons to GitHub, e.g. as part of comments inside pull requests.

Methods

write(reports[, hide_matching_columns])

Write the provided reports to this writer's sink.

write(reports: dict[str, Report], hide_matching_columns: bool = False) None[source]

Write the provided reports to this writer’s sink.

Args:

reports: A set of reports, mapped from an identifier to the report. hide_matching_columns: Whether to hide columns from the report which show a perfect

(i.e. 100%) match rate.

class sqlcompyre.report.writers.StdoutWriter(formatter: Formatter)[source]

Bases: Writer

Writer that outputs reports to standard output.

Methods

write(reports[, hide_matching_columns])

Write the provided reports to this writer's sink.

write(reports: dict[str, Report], hide_matching_columns: bool = False) None[source]

Write the provided reports to this writer’s sink.

Args:

reports: A set of reports, mapped from an identifier to the report. hide_matching_columns: Whether to hide columns from the report which show a perfect

(i.e. 100%) match rate.

class sqlcompyre.report.writers.Writer(formatter: Formatter)[source]

Bases: ABC

Abstract base class for writers of reports.

Methods

write(reports[, hide_matching_columns])

Write the provided reports to this writer's sink.

abstract write(reports: dict[str, Report], hide_matching_columns: bool = False) None[source]

Write the provided reports to this writer’s sink.

Args:

reports: A set of reports, mapped from an identifier to the report. hide_matching_columns: Whether to hide columns from the report which show a perfect

(i.e. 100%) match rate.

sqlcompyre.report.writers.get_writer(name: str, formatter: Formatter) Writer[source]

Get the writer for the specified identifier.

Args:

name: The identifier of the writer. formatter: The formatter that the writer ought to use.

Returns:

The initialized writer.

Raises:

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