import datetime

from unitls.LogerinTxt import app_logger
from .flightDB import flightDB


def updateRiskdb(database:flightDB, data):   #创建准备组提示数据库
    fdb = database
    fdb.deleteTable("RiskTable")
    try:
        for myrow in data:
            fdb.lazyInsertData('RiskTable',myrow)
        fdb.FunctionCommit()
        return "ok"
    except Exception as e:
        app_logger.log_error(e)
        print(datetime.datetime.now(),'[数据库操作]数据库获取错误!!检查模板文件!风险提示功能失效!!')
        fdb.FunctionCommit()
        return "fail"