Bugazelle / export-csv-to-influx

The python library to write the CSV data into Influx. Support me via Bitcoin: bc1qqgkmph9cvygzxfpupv4jr4n0nfx3qumwg39j5w
BSD 3-Clause "New" or "Revised" License
35 stars 10 forks source link

empty columns throws cryptic error #34

Closed 7yl4r closed 3 years ago

7yl4r commented 3 years ago

I have a file with empty field columns; for example:

,Time,mean,climatology,anomaly,location,sensor
0,1029196800,,,,IFB,modis
1,1029283200,,,,IFB,modis

When I try csv-to-influx on this I get the following error:

# export_csv_to_influx --csv /tmp/FKdbv2_ABI_TS_MODA_daily_IFB.csv --dbname fwc_coral_disease --measurement modis_abi --field_columns mean,climatology,anomaly --tag_columns location,sensor --force_insert_even_csv_no_update True --server tylar-pc:8086 --time_column Time

Info: Database fwc_coral_disease already exists
Traceback (most recent call last):
  File "/usr/local/bin/export_csv_to_influx", line 8, in <module>
    sys.exit(export_csv_to_influx())
  File "/usr/local/lib/python3.7/site-packages/ExportCsvToInflux/exporter_object.py", line 643, in export_csv_to_influx
    force_float_columns=args.force_float_columns)
  File "/usr/local/lib/python3.7/site-packages/ExportCsvToInflux/exporter_object.py", line 402, in export_csv_to_influx
    for row, int_type, float_type in convert_csv_data_to_int_float:
  File "/usr/local/lib/python3.7/site-packages/ExportCsvToInflux/csv_object.py", line 244, in convert_csv_data_to_int_float
    int_status = int_type[key]
KeyError: 'anomaly'

A more accurate error message would be nice.

Bugazelle commented 3 years ago

Hello @7yl4r ,

Issue already fixed by following in csv_object.py

https://github.com/Bugazelle/export-csv-to-influx/commit/3b0d65894a76ad44b73b5d5d5e79afb37e6cfb9d

One more thing: I have invited you as the contributor. Really appreciate for your help in advance.

Cheers

Bugazelle commented 3 years ago

Hello @7yl4r

Released 0.1.25 to cover the fix: https://github.com/Bugazelle/export-csv-to-influx/releases/tag/v0.1.25