From 60f31ffc36b219682802f45c74cf8e767a2bae12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Al=C3=A9p=C3=A9e?= Date: Wed, 15 Nov 2023 18:34:27 +0100 Subject: [PATCH] fix header modification on csv extraction --- main.py | 1 + twincache_connector.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index eb458f8..a3949e8 100644 --- a/main.py +++ b/main.py @@ -43,6 +43,7 @@ def check_env_var(required_env_var): target_tc.import_from('extract_dir') else: # simple copy + logger.info(f"Running simple copy") r = redis.Redis(twin_cache_host, twin_cache_port, password=twin_cache_password) r.eval( """local o = redis.call('DUMP', KEYS[1]);\ diff --git a/twincache_connector.py b/twincache_connector.py index d475ebf..b4cf1fa 100644 --- a/twincache_connector.py +++ b/twincache_connector.py @@ -61,7 +61,7 @@ def import_from(self, export_path: str): os.makedirs(os.path.join(r, 'output'), exist_ok=True) with open(file_path) as f, open(output_file_path, 'w') as out: csv_r = csv.DictReader(f) - new_header = csv_r.fieldnames + new_header = csv_r.fieldnames[:] st_m = list(map(lambda st: st[0] in new_header and st[1] in new_header, ST_DETECT)) if any(st_m):