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