epicsarchiver.write

Format writers and terminal table formatters for archived event output.

Submodules

Classes

Format

Supported machine-readable output formats for the export command.

SearchTable

Formats a list of PV names into a Rich Table for the search command.

FormatTable

Renders a flat list of ArchiveEvents as a Rich table to the terminal.

Functions

write_events(→ None)

Write events to dest in the given format. Requires the [polars] extra.

Package Contents

class epicsarchiver.write.Format(*args, **kwds)[source]

Bases: enum.Enum

Supported machine-readable output formats for the export command.

JSON
CSV
ARROW
PARQUET
PB
epicsarchiver.write.write_events(dest: IO[Any], fmt: Format, events: list[epicsarchiver.retrieval.archive_event.ArchiveEvent], meta: dict[int, epicsarchiver.retrieval.archive_event.ArchiveEventsMeta] | None) None[source]

Write events to dest in the given format. Requires the [polars] extra.

Parameters:
  • dest – Binary destination to write to.

  • fmt – Output format (JSON, CSV, ARROW, or PARQUET).

  • events – Events to write.

  • meta – Optional per-year metadata.

Raises:

ValueError – If fmt is not a supported event format (e.g. PB).

class epicsarchiver.write.SearchTable[source]

Formats a list of PV names into a Rich Table for the search command.

pvs: list[str]
start: datetime.datetime | None
end: datetime.datetime | None
_search_table_title() str[source]
_create_pv_name_table(title: str) rich.table.Table[source]
render() rich.table.Table[source]

Return a Rich Table of PV names.

write() None[source]

Print the search results table to the terminal.

class epicsarchiver.write.FormatTable[source]

Renders a flat list of ArchiveEvents as a Rich table to the terminal.

events: list[epicsarchiver.retrieval.archive_event.ArchiveEvent]
pvs: tuple[str, Ellipsis]
start: datetime.datetime
end: datetime.datetime
processor: epicsarchiver.retrieval.client.processor.Processor | None
meta: dict[int, epicsarchiver.retrieval.archive_event.ArchiveEventsMeta] | None
_meta_field_values() dict[int, dict[str, str]][source]
static _table_caption(field_values: dict[int, dict[str, str]]) str | None[source]
_table_title() str[source]
_create_table(title: str, caption: str | None) rich.table.Table[source]
render() rich.table.Table[source]

Render events as a Rich Table.

Returns:

Rich Table ready to print.

Return type:

Table

write() None[source]

Print the rendered table to the terminal.