1
我使用pyodbc導入sql大數據。但沒有錯誤,沒有保存的文件和消息(數據有300000行和600列)Python:odbc數據加載錯誤
如何在python odbc中加載大數據?
這是我的代碼:
import pyodbc
import pandas as pd
H2=pyodbc.connect('DRIVER={SQL Server}; SERVER={192.168.x.x};DATABASE={H2};UID=hoho;PWD=haha')
cursor=H2.cursor()
cursor.execute("Select * From [dbo].[HIST_UTDATA001_201506]")
fieldnames1=[f[0] for f in cursor.description]
result=[]
result=cursor.fetchmany(1000)
b1=result
while b1:
b1=cursor.fetchmany(1000)
if not b1:
break
result.extend(b1)
df = pd.DataFrame(result,columns=[fieldnames1])
df.to_csv('TEST1.csv')
當我嘗試,我的python shell重新啓動後很長時間 –
你可以提供表的架構 – The6thSense