我的代码是,
import MySQLdb
import collections
from pymongo import Connection
from config.MySQLdb import *
from config.MongoDB import *
from config.SyncTables import *
db = MySQLdb.connect(DB_HOST,DB_USR,DB_PWD,DB_NAME)
cursor = db.cursor()
query = "SELECT * FROM table_name WHERE userid = 1"
cursor.execute(query)
row = cursor.fetchall()
mconn = Connection(MONGODB_HOST,MONGODB_PORT)
mdb = mconn[MONGODB_DBNAME]
#col = mdb[trngl_advertiser_agegroup]
db.trngl_advertiser_agegroup .insert({'id': row[0],'userid':row[1], 'ageid':row[2], 'age_value':row[3], \ 'created':row[4], 'modified':row[5]})
print "after update"
但我收到了这个错误,
triongle@triongle.com [~/download/DataInsertionScript]# python IngestDataToMongo.py
File "IngestDataToMongo.py", line 21
db.table_name.insert({'id': row[0],'userid':row[1], 'ageid':row[2], 'age_value':row[3],\ 'created':row[4], 'modified':row[5]})
^
SyntaxError: unexpected character after line continuation character
但是之后我没有看到任何意想不到的角色。所以请告诉我,为什么我会收到这个错误
错误图像是,