PythonAPI运行代码加载dolphindb

问题描述

问题出现的环境背景及自己尝试过哪些方法

相关代码

import datetime
import dolphindb
import dolphindb.settings as keys
import pandas as pd
import numpy as np

ddb = dolphindb.session()
ddb.connect("localhost", 8848, "admin", "123456")

CREATE_TABLE = """
ticks_db = database("dfs://ticks", VALUE, 2020.06.23..2020.06.24)
ticks_table = table(

array(DATE, 0) as Date,
array(TIME, 0) as Time,
array(SYMBOL, 0) as Code,
array(DOUBLE, 0) as Price,
array(LONG, 0) as Volume,
array(DOUBLE, 0) as AskPrice,
array(LONG, 0) as AskVolume,
array(DOUBLE, 0) as BidPrice,
array(LONG, 0) as BidVolume

)
ticks_db.createPartitionedTable(ticks_table, ticks_table, Date)
"""

ddb.run(CREATE_TABLE)粘贴代码文本(请勿用截图)

你期待的结果是什么?实际看到的错误信息又是什么?

<Server Exception> in run: Received invalid serialized data during deserialization!

阅读 1.5k
1 个回答

可以先在GUI中运行sql脚本,以下代码运行通过。原脚本调用createPartitionedTable时,第2第3参数缺少引号。

ticks_db = database("dfs://ticks", VALUE, 2020.06.23..2020.06.24)
ticks_table = table(

array(DATE, 0) as Date,
array(TIME, 0) as Time,
array(SYMBOL, 0) as Code,
array(DOUBLE, 0) as Price,
array(LONG, 0) as Volume,
array(DOUBLE, 0) as AskPrice,
array(LONG, 0) as AskVolume,
array(DOUBLE, 0) as BidPrice,
array(LONG, 0) as BidVolume
)
ticks_db.createPartitionedTable(ticks_table,`ticks_table, `Date)
推荐问题
logo
101 新手上路
子站问答
访问
宣传栏