首页 > 解决方案 > 关于“流表不支持直接访问的错误。请使用sql查询检索数据”

问题描述

我创建了一个流表:

colName=["time","x"]
colType=["timestamp","int"]
t = streamTable(100:0, colName, colType);
enableTableShareAndPersistence(table=t, tableName=`st, cacheSize=1200000)

然后我在其中插入两条数据:

time = 0..1 + now()
x = 10 20
data = table(time, x)
st.append!(data )
Select the data in time column:
st.time

错误显示:

A stream table does not support direct access. Please use sql query to retrieve data

我该如何解决?

标签: dolphindb

解决方案


流表(streamTable)可以理解为一种特殊的内存表,目前不支持st.time访问方式,但支持SQL查询访问方式,如下:

select time from st

结果:|时间| |----| |2021.08.06T12:08:59.504| |2021.08.06T12:08:59.505|


推荐阅读