data=[]
dataToInsert = [ ]
for index, row in df.iterrows():
contentid = row['CONTENTID']
Objectsummary = row['OBJECT_SUMMARY']
Title=row['TITLE']
if Title is None:
Title = ""
if Objectsummary is None:
Objectsummary = ""
allSummeries =Title + ' ' + Objectsummary
lists=function_togetNounsAndVerbs(allSummeries)
verbList =lists[0]
nounList =lists[1]
NounSet = set(nounList)
VerbSet = set(verbList)
verbs = " "
verbs=verbs.join(VerbSet)
nouns=" "
nouns=nouns.join(NounSet)
verbs=re.sub(r" ", ", ", verbs)
nouns=re.sub(r" ", ", ", nouns)
# Here we are going to create the data sdet to be updated in database table in batch form.
data.append(nouns)
data.append(verbs)
data.append('PROCESSED')
data.append(contentid)
dataToInsert.append([data[0], data[1], data[2], data[3]])
print("ALL DATA TO BE UPDATED IN TABLE IS :---> ",dataToInsert)
statement = """UPDATE test_batch_update_python SET NOUNS = ?, Verbs = ? where CONTENTID = ?"""
a = cursor.executemany(statement, dataToInsert)
connection.commit()
In above code function_togetNounsAndVerbs(allSummeries) this function will return the lists. I am getting following exception:
**a = cursor.executemany(statement, dataToInsert)
cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number**
Please help me with this. Or what are the other ways I can do this. Initially I used to update single row at a time using cursor.execute() but it was very time consuming. To minimize the time i am using bulk upload (i.e. cursor.executemany() )