【发布时间】:2020-08-20 12:48:15
【问题描述】:
我正在尝试在我的数据库上实现选择,但每次将 datetime.now() 设置为 arg 时,它都不会返回列表。
Sqlite3 命令:
if from_date is not None and to_date is not None:
ping_select = """
select valor
from dispatcher_storage
where timestamp between ? and ? and chave = ?
"""
self.data_base_conn.execute(ping_select, (from_date, to_date, key))
sql_time_history = self.data_base_conn.fetchall()
self.sqliteConnection.commit()
其他模块的代码部分是:
ping_histogram = Dispatcher().fetch_all("provider_ping", date_past, datetime.now())
但是,当我将None 代替datetime.now() 代码工作并且我得到了值时,我没有看到问题。
【问题讨论】:
标签: python sql python-3.x sqlite