From 555d4bbbf8c04f26d79447619b235727103427e8 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Fri, 10 Jan 2020 23:52:07 +0100 Subject: [PATCH] throw exception when it's the legacy format --- to_line_protocol.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/to_line_protocol.py b/to_line_protocol.py index 355ba38..b5b3c66 100755 --- a/to_line_protocol.py +++ b/to_line_protocol.py @@ -16,11 +16,11 @@ CSV file spec: Semiconlos are used as delimiters. First line are the header columns. Generally the column name is used as a DB field name, but there are some legacy - exceptions like "time" instead of "Time" as listed in the following table. + exceptions like "temperature" instead of "Temp" as listed in the following table. - | DB Field | DB field | CSV Column | CSV Format + | DB Field name | DB field | CSV Column | CSV Format |--------------------|----------|--------------------|-------------------------- - | time | time | Time | 2017/05/19 00:00:11 (UTC) + | none | time | Time | 2017/05/19 00:00:11 (UTC) | ? | ? | durP1 | | ? | ? | ratioP1 | | ? | ? | P1 | @@ -75,6 +75,12 @@ NAME_MAP = { READER = csv.DictReader(sys.stdin, delimiter=";") for row in READER: + # error out on legacy format until it's clear what that format is + if row["Time"] == "time": + raise Exception( + "Looks like a legacy format not supported yet. Send the file to the author please." + ) + # catch multiple column headers if row["Time"] == "Time": continue