fix:カンマ削除処理の設定ファイル修正に伴う変更
This commit is contained in:
parent
8fa4f7df8d
commit
012a88490f
@ -24,7 +24,14 @@ SETTINGS_ITEM = {
|
||||
'storageSchemaName': 9,
|
||||
'loadSchemaName': 10,
|
||||
'exSqlFileName': 11,
|
||||
'importManner': 12,
|
||||
'reserved0': 12,
|
||||
'importManner': 13,
|
||||
'reserved1': 14,
|
||||
'reserved2': 15,
|
||||
'reserved3': 16,
|
||||
'reserved4': 17,
|
||||
'reserved5': 18,
|
||||
'reserved6': 19
|
||||
}
|
||||
LINE_FEED_CODE = {
|
||||
'CR': '\r',
|
||||
@ -80,13 +87,18 @@ def main(bucket_name, target_data_source, target_file_name, settings_key, db_inf
|
||||
cur.execute(f'SET time_zone = "+9:00"')
|
||||
print(f'{datetime.now():%Y-%m-%d %H:%M:%S} {log_info} {LOG_LEVEL["i"]} I-MAIN-03 - タイムゾーンを変更しました')
|
||||
|
||||
# ④ 個別設定ファイルのロードスキーマのテーブル名に記載されているテーブルをTRUNCATEする
|
||||
# 個別設定ファイルの読み込み
|
||||
settings_obj = s3_resource.Object(bucket_name, settings_key)
|
||||
settings_response = settings_obj.get()
|
||||
settings_list = []
|
||||
for line in io.TextIOWrapper(io.BytesIO(settings_response["Body"].read()), encoding='utf-8'):
|
||||
settings_list.append(line.rstrip('\n'))
|
||||
|
||||
# 予約行挿入のためsetting_listとSETTINGS_ITEMの要素数を揃える
|
||||
for _ in range(len(SETTINGS_ITEM) - len(settings_list)):
|
||||
settings_list.append('')
|
||||
|
||||
# ロードスキーマのTRUNCATE
|
||||
with conn.cursor() as cur:
|
||||
sql_truncate = f'TRUNCATE table {settings_list[SETTINGS_ITEM["loadSchemaName"]]}'
|
||||
cur.execute(sql_truncate)
|
||||
@ -302,8 +314,6 @@ def truncate_judge(settings_list):
|
||||
"""
|
||||
|
||||
# upsert判定
|
||||
if len(settings_list) < 13:
|
||||
return False
|
||||
if not settings_list[SETTINGS_ITEM["importManner"]]:
|
||||
return False
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user