Skip to content

output

etl_craft.cli.output

The only place etl-craft writes to the terminal.

Command results go to standard output, so they can be piped; errors go to standard error, next to the log records.

Output

Writes a command's results and errors.

The streams default to the current sys.stdout and sys.stderr, looked up at each write, so redirecting them after construction still takes effect.

stdout property

stdout: TextIO

The stream results are written to.

stderr property

stderr: TextIO

The stream errors are written to.

__init__

__init__(stdout: TextIO | None = None, stderr: TextIO | None = None) -> None

Write to the given streams instead of the process's standard streams.

line

line(text: str = '') -> None

Write one line of results.

document

document(result: object) -> None

Write the same JSON document returned by the service serializer.

result

result(done: object, output_format: str, *, text: Callable[[], None] | None = None) -> None

Write JSON or render the command's text, defaulting to its outcome message.

rows

rows(rows: Iterable[Iterable[object]]) -> None

Write one tab-separated line per row; None becomes an empty field.

empty

empty(what: str) -> None

Report a result with nothing in it, such as (no active pipelines).

error

error(message: str) -> None

Write error: <message> to standard error.