zabgrab.adapters.formats.delimited

Tab- and comma-separated output.

Layout:

  • # comment lines with the metadata as JSON (numpy and pandas skip them with comment="#")

  • a header row, then columns per item: time and value (plus log fields for log items), or the selected trend statistics

  • shorter series are padded with empty cells across all of their columns

  • times are ISO 8601 with the offset of the configured timezone

Text values containing the separator, quotes or newlines are quoted, so multi-line log entries need a CSV-aware reader such as pandas.

zabgrab.adapters.formats.delimited.TIME_COLUMNS

Columns holding times, written as ISO 8601.

Type:

frozenset of str

Functions

write_delimited(path, result, metadata, *, ...)

Write fetched data to a delimited file, atomically.

zabgrab.adapters.formats.delimited.write_delimited(path, result, metadata, *, delimiter, tz)[source]

Write fetched data to a delimited file, atomically.

Parameters:
  • path (Path) – The file to write (replaced if it exists).

  • result (FetchResult) – The data.

  • metadata (mapping) – The metadata, written as # comment lines.

  • delimiter (str) – A tab or a comma.

  • tz (tzinfo or None) – The time zone for times (None for local time).

Raises:

ZabgrabError – If the file can’t be written.

Return type:

None