[問題] pandas.to_sql chunksize大小
大家好
我現在用pandas的to_sql把一張張的CSV塞進去一個sqlite3的資料庫
我上網看別人在設定chunksize的時候 都可以設個幾千幾萬的
可是我只設了200就會吐錯誤 設150才能跑
sqlite3.OperationalError: too many SQL variables
我的code如下
import sqlite3
import pandas as pd
conn = sqlite3.connect("test_2.db")
cur = conn.cursor()
create_table="CREATE TABLE IF NOT EXISTS test (x,y,value)"
cur.execute(create_table)
df2=pd.read_csv("test.csv",index_col=False)
df2.to_sql('test',conn,if_exists='append',
index=False,method='multi',chunksize=200)
請問是因為sqlite3的chunksize真的只有這麼小 還是我哪邊理解錯誤啊?
謝謝大大
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.134.51.64 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1610528148.A.2EA.html
→
01/14 15:23,
4年前
, 1F
01/14 15:23, 1F
→
01/14 15:24,
4年前
, 2F
01/14 15:24, 2F
→
01/14 15:25,
4年前
, 3F
01/14 15:25, 3F
Python 近期熱門文章
PTT數位生活區 即時熱門文章