首页 > 解决方案 > 使用Sqlalchemy查询SQL,无法返回最新数据

问题描述

我发现了一个问题:它没有查询回最新的“SamplingTime”。查询结果中最新的'SamplingTime'是“10-16”,在数据库中是“10-18”。如何解决?

sql_query = session.execute("select top 1 SamplingTime from SampleData order by SamplingTime desc")
record = sql_query.fetchall()
print(record)

在此处输入图像描述

在此处输入图像描述

标签: pythonsqlalchemy

解决方案


推荐阅读