●方法定义
get_rawRecords_BySpecifyNum(self,timestamp,nQueryNum,bLes sThanQueryTime)
●方法参数说明
参数名称 |
参数说明 |
参数类型 |
默认值 |
timestamp |
查询的时间点 |
datetime或者HDTime类型 |
|
nQueryNum |
待查询的记录数,不能超过65535条记录 |
数字型 |
|
bLessThanQueryTime |
查询的方向,True则,查询的数据的时间戳小于等于查询时间点;否则大于等于查询的时间点 |
布尔型 |
|
●异常
如果调用失败,抛出hyperdb.HDError异常
如果参数错误,抛出HDParaError异常
●返回值
元组(实际查询的记录数,查询记录列表)。其中,查询记录类型为record.HDRecord
●方法调用
def GetRawRecordsBySpecifyNum(self):
tagname = "tag_int16_10"
tag_self = self.myTagMgr.get_tag(tagname)
time_stamp = datetime.datetime(2023, 10, 17, 15, 54, 40)
num_query = 10
ret = tag_self.get_rawRecords_BySpecifyNum(timestamp=time_stamp, nQueryNum=num_query, bLessThanQueryTime=True)
len_rec = len(ret[1])
print("The num of records:", ret[0])
for i in range(len_rec):
print("snapshot quality: ", ret[1][i].quality, "snapshot value: ",ret[1][i].value, ", timestamp: ", ret[1][i].sec)