feat:下田さんのレビュー指摘再修正
This commit is contained in:
parent
9709ba1180
commit
13d55634db
@ -148,8 +148,8 @@ def main(bucket_name, target_data_source, target_file_name, settings_key, db_inf
|
||||
|
||||
# データ項目値の変換処理
|
||||
org_column_value = line[i]
|
||||
current_settings_db_columu_name = settings_db_columu_list[i]
|
||||
column_value = convert_column_value(org_column_value,current_settings_db_columu_name,settings_replace_comma_list)
|
||||
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)
|
||||
sql = f'{sql} "{column_value}",'
|
||||
|
||||
sql = f'{sql} "{target_file_name}",' # システム項目:取込ファイル名
|
||||
@ -293,13 +293,22 @@ def connection_close(conn, bucket_name, target_data_source, target_file_name, lo
|
||||
print(f'{datetime.now():%Y-%m-%d %H:%M:%S} {log_info} {LOG_LEVEL["e"]} E-MAIN-99 - エラー内容:{e}')
|
||||
error(bucket_name, target_data_source, target_file_name, log_info)
|
||||
|
||||
def convert_column_value(org_column_value,current_settings_db_columu_name,settings_replace_comma_list):
|
||||
|
||||
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カラム物理名
|
||||
settings_replace_comma_list : 投入データの数値型のDBカラム物理名のリスト
|
||||
|
||||
Returns:
|
||||
converted_column_value:変換処理を行った投入データの値
|
||||
"""
|
||||
# データ内の「\\」という文字がpythonで読んだ場合に「\\\\」となるため、「\\」に戻す
|
||||
converted_column_value = org_column_value.replace('\\', '\\\\')
|
||||
|
||||
# 投入データのDB物理カラム名が設定ファイルの数値型のDBカラム物理名に含まれている場合、データ項目値の「,」を取り除く
|
||||
if current_settings_db_columu_name in settings_replace_comma_list:
|
||||
if current_settings_db_column_name in settings_replace_comma_list:
|
||||
converted_column_value = converted_column_value.replace(',', '')
|
||||
|
||||
return converted_column_value
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user