我一直有 sql 语法错误。为了每天提取数据,我在这里遗漏了什么。
这是我的python错误:
pyodbc.ProgrammingError: ('42000', "[42000] [MySQL][ODBC 5.1 Driver][mysqld-5.1.63rel13.4-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s and date_created < %s ,(start, next)' at line 11 (1064) (SQLExecDirectW)")
File "d:\sasdev\datax\program\py\global.py", line 33, in <module>
""")
这是代码:
start = datetime.date(2012,01,01)
next = start + datetime.date.resolution
while next <= datetime.date.today():
print start, next
cur_ca.execute("""
select id,
date_created,
data
from bureau_inquiry where date_created >= %s and date_created < %s %(start, next)
""")
start = next
next = start + datetime.date.resolution