当我这样创建sql查询时:
param = (date, )
query = SELECT date_added from deploy_requests WHERE date_added LIKE '%s %'
query.execute(query, param)
我遇到语法错误
但是如果我使用不推荐的方式
query = SELECT date_added from deploy_requests WHERE date_added LIKE '{} %'.format(date)
答案 0 :(得分:0)
我发现,这就是我的方法。
def get_deployment_times(date):
date = "{}%".format(date)
param = (date, )
query = "SELECT date_added from deploy_requests WHERE date_added LIKE %s"