Inserting the rows into oracle table with cursor execute takes a lot of time in my python script. Turned auto-commit to false but still the same. Tried executemany with no luck, as it throws error. Below is my code:
insert_statement='INSERT INTO mytable
VALUES (:1,:2)
'
r = requests.get(url,cert=(auth_certificate,priv_key),verify=root_cert, timeout=3600, stream=True)
data=json.loads(r.text)
for item in data:
try:
id=(item.Get('data').get("test").get("id"))
except Attribute Error:
id=''
try:
name=(item.Get('data').get("name"))
except Attribute Error:
name=''
rows=(id,name)
cursor.Executemany(insert_statement,rows)
connection_target.commit()
this throws error: TypeError: parameters should be a list of sequences/dictionaries or an integer specifying the number of times to execute the statement
could you please advise how to correctly use executemany with json data ?
Here the sample json data :
json_data=[{
"publishTime" : "2021-05-29T12:52:15.129Z",
"data" : {
"identifier" : {
"domain" : "AB",
"id" : "1771374",
"version" : "58593668"
},
"Accounts" : [
{
"effectiveEndDate" : "3000-01-01T00:00:00Z",
"Name" : "w (S)",
"effectiveStartDate" : "2016-09-16T04:21:33Z",
"sAccount" : "SGLDPB_A"
}
]
}
}]