Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dask如何在Python中读取SQL Server_Python_Odbc_Dask_Pyodbc - Fatal编程技术网

Dask如何在Python中读取SQL Server

Dask如何在Python中读取SQL Server,python,odbc,dask,pyodbc,Python,Odbc,Dask,Pyodbc,我必须使用dask数据帧,因为我的数据是巨大的1.5亿行和50000列 我试着用 conn = pyodbc.connect('Driver={SQL Server};' 'Server=DELL;' 'Database=DB;' 'Trusted_Connection=yes;') df_features = dd.read_sql_table(table="Fe

我必须使用dask数据帧,因为我的数据是巨大的1.5亿行和50000列

我试着用

conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=DELL;'
                      'Database=DB;'
                      'Trusted_Connection=yes;')
df_features = dd.read_sql_table(table="Features" , con=conn , index_col="ID")
我犯了这个错误

TypeError: read_sql_table() missing 1 required positional argument: 'uri'
OperationalError: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC SQL Server Driver]Neither DSN nor SERVER keyword supplied (0) (SQLDriverConnect)')
(Background on this error at: http://sqlalche.me/e/e3q8)
所以我试过这个

df_features = dd.read_sql_table(table="Features" , uri="mssql+pyodbc:///?odbc_connect=Driver={SQL Server}; Server=DELL; Database=DB; Trusted_Connection=yes;", index_col="ID")
我犯了这个错误

TypeError: read_sql_table() missing 1 required positional argument: 'uri'
OperationalError: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC SQL Server Driver]Neither DSN nor SERVER keyword supplied (0) (SQLDriverConnect)')
(Background on this error at: http://sqlalche.me/e/e3q8)

如何在dask数据帧中连接到SQL Server?

@Giorgos Myrianthous的思路是正确的:您需要一个URI,而不是一些连接对象。此URI的格式必须是SQLalchemy能够理解的,因此请阅读他们的文档,了解如何为ODBC设置格式

文件:


原因是,Dask需要能够序列化和传递任务,但不能序列化连接对象。但是,如果您仅使用线程,则可以传递SQLalchemy引擎对象(这在master中)

Windows ODBC驱动程序管理器在关键字和
=


下面应该可以做到这一点:

df_features = dd.read_sql_table(
    table="Features",
    uri="mssql+pyodbc:///?odbc_connect=DRIVER={SQL Server};SERVER=my.db.server;DATABASE=DB;Trusted_Connection=yes;",
    index_col="ID"
)

你能连接到数据库吗
isql-v-k”“
我可以使用Pandas数据帧使用相同的连接字符串进行连接,但dask不工作/etc/ssl/openssl.cnf是什么?你能试试吗
uri=“mssql+pyodbc://?odbc\u connect=Driver={SQL Server};Server=DELL;DATABASE=DB;Trusted\u Connection=yes;”
这与我尝试的相同,并给出了错误