我在使用以下代码时遇到问题:
start_date = dt.datetime(2012,01,01,00,00,00)
end_date = dt.datetime(2014,01,01,00,00,00)
sql="SELECT c.id extension, er.id, flow, filename, filesize, unread, er.cr_date, callerid, \
length, callid, info, party FROM extension_recording er, extension e, client c \
WHERE er.extension_id = e.id AND e.client_id = c.id AND c.parent_client_id = %s \
AND er.cr_date => %s AND er.cr_date <= %s" % (client_id) (start_date) (end_date)
cur.execute(sql)
recordings = cur.fetchall()
if recordings.rowcount == 0: sys.exit("No recordings for selected date range - exiting")
for recording in recordings:
do stuff to recording
构建查询字符串会导致以下错误:
TypeError: 'str' object is not callable
我确定我遗漏了一些非常明显的东西,但我看不到树木的树木。