datalogd.plugins.csv_datafilter module¶
- class datalogd.plugins.csv_datafilter.CSVDataFilter(sinks=[], keys=['timestamp', 'value'], labels=['timestamp', '{type}_{id}'], header='every')[source]¶
Bases:
DataFilterFormat received data into a table of comma separated values.
The column headers can be formatted using values from the data. For example, for the data:
[ {'type': 'temperature', 'id': '0', 'value': 22.35}, {'type': 'humidity', 'id': '0', 'value': 55.0}, {'type': 'temperature', 'id': '1', 'value': 25.80}, ]
and a node initialised using:
sink [class=CSVDataSink keys="['value']", labels="['{type}_{id}'"];
the output will be:
temperature_0,humidity_0,temperature_1 22.35,55.0,25.80
Setting
labelstoNonewill disable the column headers.By default, the column headers will be generated on every receipt of data. To instead output the column headers only once on the first receipt of data, use the parameter
header="once". Settingheader=Nonewill also disable the headers completely.- Parameters:
keys – Name of data keys to format into columns of the CSV.
labels – Labels for the column headers, which may contain mappings to data values.
header – Display the column header
"once"or"every"orNone.