I've read other posts in this form, but still do not know why I get this error:
File "/home/amr/bin/mysql_lib.py", line 196, in createNewCsRowSQL
db_date + ");"
TypeError: cannot concatenate 'str' and 'long' objects
from this code
sql_cmd = \
"INSERT INTO customer_synch " + \
"VALUES ( " + \
"'A', " + \
incoming_data[0] + "," + \
incoming_data[1] + "," + \
incoming_data[2] + "," + \
incoming_data[3] + "," + \
incoming_data[4] + "," + \
incoming_data[4] + "," + \
incoming_data[4] + "," + \
lnam_fnam_l[0] + "," + \
lnam_fnam_l[1] + "," + \
incoming_data[11] + "," + \
incoming_data[5] + "," + \
incoming_data[10] + "," + \
incoming_data[12] + "," + \
incoming_data[13] + "," + \
incoming_data[14] + "," + \
incoming_data[15] + "," + \
incoming_data[16] + "," + \
incoming_data[17] + "," + \
"," + \
"," + \
str(0) + "," + \
str(incoming_data[4]) + "," + \
db_date + ");"
I've tried putting db_date inside a str() call, and also have tried adding '" + to the string. db_date is a date derived from
def getMySQLDateTime():
now = datetime.today()
db_date = now.strftime("%Y-%m-%d %H:%M:%S")
return db_date
The rest of incoming_data is a mix of different types, including strings, integers, and decimals.
I would love some ideas on how to fix this.