第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

通過 select ... where ... 命令使用 python.connector 時(shí)出錯(cuò)

通過 select ... where ... 命令使用 python.connector 時(shí)出錯(cuò)

胡說叔叔 2023-05-09 10:11:36
當(dāng)我運(yùn)行這個(gè)函數(shù)時(shí)發(fā)生了一些錯(cuò)誤,但我不知道出了什么問題。def insertVariblesIntoTable(newepc, newtimestamp):    try:        connection = mysql.connector.connect(host='localhost',                                             database='myDB',                                             user='root',                                             password='root')        cursor = connection.cursor()        mySql_insert_query = """INSERT INTO myTB(epc,time_stamp)                                  SELECT newepc,newtimestamp                                    FROM dual                                    WHERE NOT EXISTS (SELECT * FROM myTB                                                        WHERE epc=newepc                                                         AND time_stamp>NOW()-INTERVAL 1 MINUTE )"""        cursor.execute(mySql_insert_query)        connection.commit()        print("Record inserted successfully into myTB table")    except mysql.connector.Error as error:        print("Failed to insert into MySQL table {}".format(error))    finally:        if (connection.is_connected()):            cursor.close()            connection.close()            # print("MySQL connection is closed")錯(cuò)誤:無法插入 MySQL 表 1054 (42S22):“字段列表”中的未知列“newepc”
查看完整描述

1 回答

?
瀟瀟雨雨

TA貢獻(xiàn)1833條經(jīng)驗(yàn) 獲得超4個(gè)贊

據(jù)我所知,您正在嘗試訪問一個(gè)不存在的名為“newepc”的列。發(fā)生這種情況是因?yàn)槟鷽]有在選擇查詢中轉(zhuǎn)義變量“newepc”,mySql 不知道它應(yīng)該是一個(gè)變量。您可以嘗試 f-Strings 或只是正常的連接。



查看完整回答
反對(duì) 回復(fù) 2023-05-09
  • 1 回答
  • 0 關(guān)注
  • 119 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)