python api 使用 table 方法,创建包含 array vector 类型字段的表并上传到服务器,返回错误

# table 方法上传

s = ddb.session()

s.connect("localhost", 8848, "admin", "123456")

t0 = s.table(data=df, tableAliasName="t1")

print(s.loadTable("t1").toDF())

# 使用 table 方法,创建包含 array vector 类型字段的表并上传到服务器。

df2 = pd.DataFrame({

                'value': [np.array([1,2,3,4,5,6,7,8,9],dtype=np.int64),np.array([11,12,13,14],dtype=np.int64),np.array([22,13,11,12,13,14],dtype=np.int64)]

        })

tmp = s.table(data=df2, tableAliasName="testArrayVector")

print(s.loadTable("testArrayVector").toDF())




Traceback (most recent call last):


  File "<ipython-input-26-91669e47bbb6>", line 3, in <module>

    t0 = s.table(data=df, tableAliasName="t1")


  File "D:\soft\anaconda\lib\site-packages\dolphindb\session.py", line 1060, in table

    return Table(dbPath=dbPath, data=data,  tableAliasName=tableAliasName, inMem=inMem, partitions=partitions, s=self)


  File "D:\soft\anaconda\lib\site-packages\dolphindb\table.py", line 122, in __init__

    self.__objAddr = self.__session.upload({self.__tableName: df})


  File "D:\soft\anaconda\lib\site-packages\dolphindb\session.py", line 424, in upload

    return self.cpp.upload(nameObjectDict)


RuntimeError: <Exception> in upload: Failed to read response header from the socket with IO error type 1

请先 登录 后评论

1 个回答

saki

您可以先确认一下 server 版本是否正确,2.00 版本才支持 array vector 类型,1.30 版本不支持。我这边使用 2.00.9 以及 2.00.8 尝试了您的代码是可以的。

请先 登录 后评论