feat: pythonのコード内で呼ばれているSQLのタイムゾーンをJSTに変更

This commit is contained in:
高木要 2023-08-01 14:43:16 +09:00
parent cb47f7d186
commit 9dbec78cd6
9 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@ def exec():
db = Database.get_instance()
try:
db.connect()
db.to_jst()
db.begin()
logger.debug('DCF施設統合マスタ作成処理開始')
# COM施設からDCF施設統合マスタに登録

View File

@ -14,6 +14,7 @@ def exec():
db = Database.get_instance()
try:
db.connect()
db.to_jst()
db.begin()
logger.debug('DCF施設統合マスタ日次更新処理開始')
# DCF施設統合マスタ移行先コードのセット(無効フラグが『0(有効)』)

View File

@ -13,6 +13,7 @@ def exec():
db = Database.get_instance()
try:
db.connect()
db.to_jst()
logger.debug('##########################')
logger.debug('START Changing Employee in charge of institution PGM.')
# `emp_chg_inst_lau`をTruncate

View File

@ -11,6 +11,7 @@ def exec():
db = Database.get_instance(autocommit=True)
try:
db.connect()
db.to_jst()
logger.debug('処理開始')
# 卸販売実績テーブル(洗替後)過去5年以前のデータ削除
_call_sales_lau_delete(db)

View File

@ -180,6 +180,9 @@ class Database:
self.__connection.close()
self.__connection = None
def to_jst(self):
self.execute('SET time_zone = "+9:00"')
def __execute_with_transaction(self, query: str, parameters: dict):
# トランザクションを開始してクエリを実行する
with self.__connection.begin():

View File

@ -180,6 +180,9 @@ class Database:
self.__connection.close()
self.__connection = None
def to_jst(self):
self.execute('SET time_zone = "+9:00"')
def __execute_with_transaction(self, query: str, parameters: dict):
# トランザクションを開始してクエリを実行する
with self.__connection.begin():

View File

@ -30,6 +30,7 @@ class MasterMainteEmpChgInstFunction(metaclass=ABCMeta):
error_list = []
try:
self.emp_chginst_repository.connect()
self.emp_chginst_repository.to_jst()
self.emp_chginst_repository.begin()
(result_message, error_list) = self.write_emp_chg_inst_table()
if len(error_list) > 0:

View File

@ -13,6 +13,9 @@ class EmpChgInstRepository(BaseRepository):
def connect(self):
self._database.connect()
def to_jst(self):
self._database.to_jst()
def begin(self):
self._database.begin()
@ -110,7 +113,7 @@ class EmpChgInstRepository(BaseRepository):
SET
emp_cd = :emp_cd,
updater = :update_user_name,
update_date = now()
update_date = NOW()
where
inst_cd = :inst_cd
and ta_cd = :ta_cd

View File

@ -149,6 +149,7 @@ class MasterMainteService(BaseService):
def copy_data_real_to_dummy(self) -> TableOverrideViewModel:
try:
self.emp_chginst_repository.connect()
self.emp_chginst_repository.to_jst()
self.emp_chginst_repository.begin()
self.emp_chginst_repository.delete_dummy_table()
self.emp_chginst_repository.copy_real_to_dummy()