:py:mod:`flow.record.adapter.csvfile` ===================================== .. py:module:: flow.record.adapter.csvfile Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: flow.record.adapter.csvfile.CsvfileWriter flow.record.adapter.csvfile.CsvfileReader Attributes ~~~~~~~~~~ .. autoapisummary:: flow.record.adapter.csvfile.__usage__ .. py:data:: __usage__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ Comma-separated values (CSV) adapter --- Write usage: rdump -w csvfile://[PATH]?lineterminator=[TERMINATOR]&header=[HEADER] Read usage: rdump csvfile://[PATH]?fields=[FIELDS] [PATH]: path to file. Leave empty or "-" to output to stdout Optional parameters: [HEADER]: if set to false, it will not print the CSV header (default: true) [TERMINATOR]: line terminator, default is \r\n [FIELDS]: comma-separated list of CSV fields (in case of missing CSV header) """ .. raw:: html
.. py:class:: CsvfileWriter(path: str | pathlib.Path | None, fields: str | list[str] | None = None, exclude: str | list[str] | None = None, lineterminator: str = '\r\n', header: str = 'true', **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractWriter` .. py:attribute:: fp :value: None .. py:attribute:: lineterminator :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:attribute:: desc :value: None .. py:attribute:: writer :value: None .. py:attribute:: fields :value: None .. py:attribute:: exclude :value: None .. py:attribute:: header .. py:method:: write(r: flow.record.base.Record) -> None Write a record. .. py:method:: flush() -> None Flush any buffered writes. .. py:method:: close() -> None Close the Writer, no more writes will be possible. .. py:class:: CsvfileReader(path: str | pathlib.Path | None, selector: str | None = None, fields: str | list[str] | None = None, **kwargs) Bases: :py:obj:`flow.record.adapter.AbstractReader` .. py:attribute:: fp :value: None .. py:attribute:: selector :value: None .. py:attribute:: dialect :value: 'excel' .. py:attribute:: reader .. py:attribute:: fields .. py:attribute:: desc .. py:method:: close() -> None Close the Reader, can be overriden to properly free resources. .. py:method:: __iter__() -> collections.abc.Iterator[flow.record.base.Record] Return a record iterator.