我在DolphinDB中创建了一个streamtable,在类型'TIMESTAMP‘中定义了一个列类型,而time只能在pandas DataFrame中的类型datetime64ns中定义,该类型将在DolphinDB中转换为nanotimestamp。如果将数据帧直接插入到streamTable中,则可能会错误处理时间。除了使用SQL语句转换数据帧的类型之外,还有没有其他方法来处理这个问题?
发布于 2021-11-25 23:07:13
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.
https://stackoverflow.com/questions/70105713
复制