From 9280a7cdab026e88c801f184ed8b8c2ef09768dc Mon Sep 17 00:00:00 2001 From: "shimoda.m@nds-tyo.co.jp" Date: Fri, 16 Sep 2022 13:12:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E5=80=A4=E3=81=AE=E3=82=AB?= =?UTF-8?q?=E3=83=B3=E3=83=9E=E9=99=A4=E5=8E=BB=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E8=BB=BD=E5=BE=AE=E3=81=AA=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=82=82=E4=B8=80=E7=B7=92=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecs/dataimport/dataimport/main.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ecs/dataimport/dataimport/main.py b/ecs/dataimport/dataimport/main.py index 816b601a..641dc8f1 100644 --- a/ecs/dataimport/dataimport/main.py +++ b/ecs/dataimport/dataimport/main.py @@ -1,12 +1,14 @@ -from datetime import datetime +import csv +import io import re +from datetime import datetime + import boto3 import pymysql from pymysql.constants import CLIENT -import io -import csv + +from common import convert_quotechar, debug_log from error import error -from common import debug_log, convert_quotechar # 定数 DIRECTORY_WORK = '/work/' @@ -150,7 +152,7 @@ def main(bucket_name, target_data_source, target_file_name, settings_key, db_inf sql = f'{sql} NULL,' continue - # データ項目値の変換処理 + # データ項目値の変換処理(カンマ除去) org_column_value = line[i] current_settings_db_column_name = settings_db_columu_list[i] column_value = convert_column_value(org_column_value, current_settings_db_column_name, settings_replace_comma_list) @@ -312,7 +314,7 @@ def connection_close(conn, bucket_name, target_data_source, target_file_name, lo def convert_column_value(org_column_value, current_settings_db_column_name, settings_replace_comma_list): """データ項目値変換処理 - + - 数値内のカンマ除去処理 Args: org_column_value : 投入データの値 current_settings_db_column_name : 投入データのDBカラム物理名 @@ -321,13 +323,14 @@ def convert_column_value(org_column_value, current_settings_db_column_name, sett Returns: converted_column_value:変換処理を行った投入データの値 """ - # 投入データのDB物理カラム名が設定ファイルの数値型のDBカラム物理名に含まれている場合、データ項目値の「,」を取り除く + # 投入データのDB物理カラム名が設定ファイルの数値型のDBカラム物理名に含まれている場合、データ項目値の「,」を取り除く + converted_column_value = org_column_value if current_settings_db_column_name in settings_replace_comma_list: converted_column_value = converted_column_value.replace(',', '') return converted_column_value - + def truncate_judge(settings_list): """TRUNCATE処理対応判定 Args: