From 8b9be6e5aec608d8a493e535143e4e791ffa9b55 Mon Sep 17 00:00:00 2001 From: Bugazelle Date: Fri, 19 Jul 2019 15:34:21 +0800 Subject: [PATCH 1/2] [Feat] Release to v0.1.12 --- src/ExportCsvToInflux/__version__.py | 2 +- src/ExportCsvToInflux/csv_object.py | 4 ++-- src/ExportCsvToInflux/exporter_object.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ExportCsvToInflux/__version__.py b/src/ExportCsvToInflux/__version__.py index 13b7089..e6d0c4f 100644 --- a/src/ExportCsvToInflux/__version__.py +++ b/src/ExportCsvToInflux/__version__.py @@ -1 +1 @@ -__version__ = '0.1.11' +__version__ = '0.1.12' diff --git a/src/ExportCsvToInflux/csv_object.py b/src/ExportCsvToInflux/csv_object.py index b8e3c88..dd00455 100755 --- a/src/ExportCsvToInflux/csv_object.py +++ b/src/ExportCsvToInflux/csv_object.py @@ -44,8 +44,8 @@ def search_files_in_dir(directory, match_suffix='.csv', filter_pattern='influx.c """ base_object = BaseObject() - match_suffix = base_object.str_to_list(match_suffix) - filter_pattern = base_object.str_to_list(filter_pattern) + match_suffix = base_object.str_to_list(match_suffix, lower=True) + filter_pattern = base_object.str_to_list(filter_pattern, lower=True) # Is file is_file = os.path.isfile(directory) diff --git a/src/ExportCsvToInflux/exporter_object.py b/src/ExportCsvToInflux/exporter_object.py index 5ad3ba7..57faf13 100755 --- a/src/ExportCsvToInflux/exporter_object.py +++ b/src/ExportCsvToInflux/exporter_object.py @@ -233,9 +233,11 @@ def export_csv_to_influx(self, if not field_columns: print('Error: The input --field_columns does not expected. ' 'Please check the fields are in csv headers or not. Exporter stopping...') + continue if not tag_columns: print('Error: The input --tag_columns does not expected. ' 'Please check the fields are in csv headers or not. Exporter stopping...') + continue match_columns = self.__validate_columns(csv_headers, match_columns) filter_columns = self.__validate_columns(csv_headers, filter_columns) @@ -253,7 +255,8 @@ def export_csv_to_influx(self, break # Check the timestamp, and generate the csv with checksum - new_csv_file = 'influx.csv' + csv_base_name = os.path.basename(csv_file_item) + new_csv_file = 'influx_{0}.csv'.format(csv_base_name) new_csv_file = os.path.join(current_dir, new_csv_file) new_csv_file_exists = os.path.exists(new_csv_file) no_new_data_status = False From b142b0515ebb8a80efbe36a42dda78c190facef9 Mon Sep 17 00:00:00 2001 From: Bugazelle Date: Fri, 19 Jul 2019 15:38:14 +0800 Subject: [PATCH 2/2] [Feat] Release to v0.1.13 --- src/ExportCsvToInflux/__version__.py | 2 +- src/ExportCsvToInflux/csv_object.py | 2 +- src/ExportCsvToInflux/exporter_object.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ExportCsvToInflux/__version__.py b/src/ExportCsvToInflux/__version__.py index e6d0c4f..377e1f6 100644 --- a/src/ExportCsvToInflux/__version__.py +++ b/src/ExportCsvToInflux/__version__.py @@ -1 +1 @@ -__version__ = '0.1.12' +__version__ = '0.1.13' diff --git a/src/ExportCsvToInflux/csv_object.py b/src/ExportCsvToInflux/csv_object.py index dd00455..efcbbbb 100755 --- a/src/ExportCsvToInflux/csv_object.py +++ b/src/ExportCsvToInflux/csv_object.py @@ -35,7 +35,7 @@ def get_csv_header(self, file_name): return headers @staticmethod - def search_files_in_dir(directory, match_suffix='.csv', filter_pattern='influx.csv'): + def search_files_in_dir(directory, match_suffix='.csv', filter_pattern='_influx.csv'): """Function: search_files_in_dir :param directory: the directory diff --git a/src/ExportCsvToInflux/exporter_object.py b/src/ExportCsvToInflux/exporter_object.py index 57faf13..bfa09e2 100755 --- a/src/ExportCsvToInflux/exporter_object.py +++ b/src/ExportCsvToInflux/exporter_object.py @@ -256,7 +256,7 @@ def export_csv_to_influx(self, # Check the timestamp, and generate the csv with checksum csv_base_name = os.path.basename(csv_file_item) - new_csv_file = 'influx_{0}.csv'.format(csv_base_name) + new_csv_file = '{0}_influx.csv'.format(csv_base_name.replace('.csv', '')) new_csv_file = os.path.join(current_dir, new_csv_file) new_csv_file_exists = os.path.exists(new_csv_file) no_new_data_status = False