无法使用 python api 查询列类型为 decimal 的表

ddb 服务 version : 2.00.9.1 2023.02.20 ; linux64

python==3.7 

dolphindb库 version : 1.30.21.1

问题描述:

        表中某列的类型为 decimal ,使用 api 查询是报错: "Failed to read response header from the socket with IO error type 1" ; 然后连接被断开。

        

请先 登录 后评论

1 个回答

Boye

在1.30.21.1版本中,Python API session 和 DBConnectionPool 新增 protocol 参数,目前已支持的参数选项包括 PROTOCOL_DDB、PROTOCOL_PICKLE、PROTOCOL_ARROW,其中默认使用 PROTOCOL_PICKLE。目前PROTOCOL_DDB和PROTOCOL_ARROW支持decimal,但是arrow返回的是arrow.Table不是DataFrame。所以您的session需要指定protocol=keys.PROTOCOL_DDB:

import dolphindb.settings as keys
s = ddb.session(protocol=keys.PROTOCOL_DDB)

此外,目前都不支持decimal arrayvector,普通的decimal列是支持的。

attachments-2023-03-JXhhDp2t641a9efda79ca.png

请先 登录 后评论