From 58e4dbaf8dce8275b6d020af0811218c0770ef45 Mon Sep 17 00:00:00 2001 From: Keiran Price Date: Mon, 29 Jul 2019 09:01:56 +0100 Subject: [PATCH] Update Create Row from JSON --- common/database_helpers.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/common/database_helpers.py b/common/database_helpers.py index 4d0e26d4..281d2297 100644 --- a/common/database_helpers.py +++ b/common/database_helpers.py @@ -211,18 +211,8 @@ def create_row_from_json(table, json): :param json: the dictionary containing the values :return: nothing atm """ - log.info(f" Creating row from json into table {table.__tablename__}") - session = get_icat_db_session() - record = table() - record.update_from_dict(json) - record.CREATE_TIME = datetime.datetime.now() # These should probably change - record.CREATE_ID = "user" - record.MOD_TIME = datetime.datetime.now() - record.MOD_ID = "user" - session.add(record) - session.commit() - log.info(" Closing db session") - session.close() + create_query = CreateQuery(table, json) + create_query.execute_query() def get_row_by_id(table, id):