DolphinDB python API:在 pandas DataFrame 中使用 DolphinDB 类型"timestamp"



我在DolphinDB中创建了一个流表,其中一列类型在类型"TIMESTAMP"中定义,而时间只能在pandas DataFrame中的类型datetime64[ns]中定义,后者将在Dolphin DB中转换为纳米时间戳。如果将数据帧直接插入streamTable,则可能会错误地处理时间。除了使用SQL语句来强制转换数据帧的类型之外,还有其他方法可以处理这个问题吗?

Python API中对象tableAppender的方法append将本地DataFrame附加到内存中的表或分区表。在此过程中,DolphinDB将自动转换时态类型。

tableAppender的语句如下所示:

tableAppender(dbPath="", tableName="", ddbSession=None, action="fitColumnType")
dbPath: path of the distributed database. Fill "" if it is an in-memory table.
tableName: name of the table
ddbSession: session handle that has connected to the DolphinDB server.
action: assigned action when appending the table. Currently only "fitColumnType" action is supported, indicating the conversion of time column type.

最新更新