【问题标题】:MySQLdb._exceptions.OperationalError: (1054, 'Unknown error 1054')MySQLdb._exceptions.OperationalError: (1054, '未知错误 1054')
【发布时间】:2020-09-25 09:03:42
【问题描述】:

1.当我更新时出现此错误

try:
            cur=db.cursor()
            print("update cur",cur)
            cur.execute('''UPDATE ast_details SET Asset_ID=%s,Make=%s,Model_No=%s,Serial_No=%s,
                    Purchased_Date=%s,Expired_Date=%s,Purchased_From=%s,Vendor_Name=%s,
                    Cost=%s,Laptop_Age=%s,Allocated_User=%s,
                    Allocated_Date=%s,Emp_ID=%s,Return_Date=%s where S.no=%s''',(ast_id,make,m_no,s_no,purch_dte,exp_dte,purch_frm,vndr_nme,cost,lap_age,alloc_usr,alloc_dte,emp_id,rtrn_dte,txtwhere))
        except mdb.MySQLError as e:
            print(e)

【问题讨论】:

  • 这不足以回答问题,请在除块 from traceback import format_exc;print(format_exc()) 中更新此内容并提供完整的堆栈跟踪。
  • 请提供reproducible example。你有什么问题?

标签: python flask mysql-python flask-mysql


【解决方案1】:
I got solution I chnaged all column names with tild symbol it works fine for me
cur.execute('''UPDATE `ast_details` SET `Asset_ID`=%s,`Make`=%s,`Model_No`=%s,`Serial_No`=%s,
                    `Purchased_Date`=%s,`Expired_Date`=%s,`Purchased_From`=%s,`Vendor_Name`=%s,
                    `Cost`=%s,`Laptop_Age`=%s,`Allocated_User`=%s,
                    `Allocated_Date`=%s,`Emp_ID`=%s,`Return_Date`=%s WHERE `S.no`=%s''',(ast_id,make,m_no,s_no,purch_dte,exp_dte,purch_frm,vndr_nme,cost,lap_age,alloc_usr,alloc_dte,emp_id,rtrn_dte,txtwhere,))

【讨论】:

    猜你喜欢
    • 2020-01-25
    • 1970-01-01
    • 2016-04-01
    • 2012-03-09
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    • 2011-11-12
    • 1970-01-01
    相关资源
    最近更新 更多