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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

MySQL 1264 (22003):列的值超出范圍

MySQL 1264 (22003):列的值超出范圍

函數(shù)式編程 2023-07-18 13:29:29
幫助大家!我在將數(shù)據(jù)插入 MySQL 數(shù)據(jù)庫時遇到這個問題。我不斷收到此錯誤連接到 MySQL 1264 (22003) 時出錯:第 1 行的“Encours”列的值超出范圍 MySQL 連接已關(guān)閉我正在執(zhí)行這段 python 代碼。我正在做的是抓取網(wǎng)頁而不是格式化它以將其插入數(shù)據(jù)庫 rows = []# loop over resultsfor result in results:# find all columns per result data = result.find_all('td')# check that columns have data if len(data) == 0:  continue # if len(data)!=0 execute the rest ISIN = data[1].getText() Libelle = data[2].getText() Nominal = normalize('NFKD',data[4].getText()).replace(' ','') Encours = normalize('NFKD',data[5].getText()).replace(' ','') DerniereEcheance = data[6].getText() InterestRate = data[7].getText().replace('%','').replace(',','.') nom = int(Nominal) enc=Encours.strip() date_time_obj = datetime.datetime.strptime(str(DerniereEcheance).strip(), '%d/%m/%Y').strftime('%Y-%m-%d') intRate = float(InterestRate) rows.append([ISIN,Libelle,nom,enc,date_time_obj,intRate])print(rows)driver.quit()"""connection"""try:    connection = mysql.connector.connect(host='localhost',                                         database='biatfinancialdata',                                         user='root',                                         password='root')    if connection.is_connected():        cursor = connection.cursor()        for row in rows:            sql = "INSERT INTO t_bta (EffectiveDate, ISIN, Libelle, Nominal, Encours,DerniereEcheance,InterestRate) VALUES (%s, %s, %s, %s, %s, %s, %s)"            val =(datetime.date.today(),row[0],row[1],row[2],row[3],row[4],row[5])            cursor.execute(sql,val)            print('im here')            connection.commit()except Error as e:    print("Error while connecting to MySQL", e)finally:    if (connection.is_connected()):        cursor.close()        connection.close()        print("MySQL connection is closed")
查看完整描述

1 回答

?
智慧大石

TA貢獻1946條經(jīng)驗 獲得超3個贊

當嘗試放置的值大于列的變量類型規(guī)范所允許的值時,通常會發(fā)生此錯誤。您沒有提到女巫列是錯誤的根源,但我們可以假設(shè)它是 varchar 字段類型,并且顯然,您超出了分配的長度。檢查輸入值和表列規(guī)格。每個字段類型都會發(fā)生此錯誤。

查看完整回答
反對 回復(fù) 2023-07-18
  • 1 回答
  • 0 關(guān)注
  • 218 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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