I have a python list with 10 string fields. One of the strings is a date and I want to write the list to an Oracle table.
I try to use executemany.
if I write all fields as strings it is OK but when I try to convert one of the fields to a date and change the table column type to DATE I get errors.
For example:
I try to change from my list (data) the field to datetime
data[0][2] = datetime.strptime(data[1][2], "%Y-%m-%d %H:%M:%S.%f")
and then I try to executemany and I got the error:
TypeError: expecting date or datetime
Maybe someone can share example or idea to solve this issue?
sample data:
and after that i try to executemany like that:
sql="insert into py_table (RECORD_DATE,TYPECOL,GMTRD) values (:1,:2,:3)"
cursor.executemany(sql, listdf)
connection_dev.commit()