使用django shell时:python manage.py shell
import datetime
from django.utils import timezone
DE = datetime.datetime(1970, 1, 1, tzinfo=timezone.utc)
cursor.execute("insert into monitor_regionserver (cluster_id, task_id, name, last_attempt_time, load, numberOfRegions, numberOfRequests, memStoreSizeMB, storefileSizeMB, readRequestsCount, writeRequestsCount, readRequestsCountPerSec, writeRequestsCountPerSec, replication_last_attempt_time, replicationMetrics) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", [30L, 484L, '', DE, 0, 0, 0, 0, 0, 0, 0, 0, 0, DE, ''])
cursor命令看起来像这样(文本换行):
cursor.execute("插入monitor_regionserver(cluster_id,task_id,name,last_attempt_time,load,numberOfRegions,numberOfRequests,memStoreSizeMB,storefileSizeMB,readRequestsCount,writeRequestsCount,readRequestsCountPerSec,writeRequestsCountPerSec,replication_last_attempt_time,replicationMetrics)值(%s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",[30L, 484L,'',DE,0,0,0,0,0,0,0,0,0,DE,''])
我总是得到错误:
ProgrammingError:(1064,"您的SQL语法有错误;请查看与您的MySQL服务器版本对应的手册,以获得正确的语法,以便在&load; numberOfRegions,numberOfRequests,memStoreSizeMB附近使用, storefileSizeMB,readRe'在第1行")
我对此问题感到困惑,有什么想法分享?