Parses InfluxDB query responses in JSON, JSONL, and Flux annotated CSV formats, and passes Parquet bodies through untouched.
Type Coercion
- Timestamps →
DateTime.t()with microsecond precision. JSON carries no column types, so this is by shape and by name: any string in InfluxDB 3's zone-less timestamp rendering (2023-11-14T22:13:20[.fraction]) is a timestamp whatever its column is called (DATE_BINaliases,selector_*(...)['time'],MAX(time)); the zoned RFC3339 form is decoded only undertime,_time,_startand_stop, where v2 emits it. A string field holding exactly that zone-less shape is decoded too — store zoned RFC3339 strings if the distinction matters. - JSON / JSONL numbers and booleans keep the types Jason decodes
- CSV cells are typed from the Flux
#datatypeannotation row when the query requested one (double,long,unsignedLong,boolean,dateTime:RFC3339[Nano]); without it (InfluxDB 3'sformat: :csv) every cell stays a string. An empty cell is left out of the row, as a null column is in JSON: CSV writes a null and an empty string alike. A newline inside a value is restored: InfluxDB 2's CSV writer sends it as\r\n
Summary
Functions
Coerces known value types in a row map.
Parses a response body based on the specified format.
Functions
Coerces known value types in a row map.
Converts timestamp strings to DateTime (see "Type Coercion" in the
moduledoc for which strings count as timestamps); leaves everything else
as-is.
Parses a response body based on the specified format.
Parameters
body- response body binaryformat- one of:json,:jsonl,:csv,:parquet
Returns
{:ok, [map()]}— list of row maps ({:ok, binary()}for:parquet){:error, reason}— parse failure