Jun-26-2018, 12:45 PM
Hi,
I'm having issues with my insert query. I keep getting the error <class 'sqlite3.OperationalError'>
Have tried several things as suggested on Google but nothing works.
My data values are populated in a list throughout my script and is the only way I can plug the values into my query.
The fields numbers and values align; I've tried all strings; I've tried using (sql_formatted,); and lastly [sql_formatted]
If I manually submit the query as one big long string in sqlite browser, it works. It's just this poncy sqlite3 library forcing me to use the (?,?,?....)format that's causing me grief.
For simplicity, I've completely broken it down:
Kind regards,
Me
I'm having issues with my insert query. I keep getting the error <class 'sqlite3.OperationalError'>
Have tried several things as suggested on Google but nothing works.
My data values are populated in a list throughout my script and is the only way I can plug the values into my query.
The fields numbers and values align; I've tried all strings; I've tried using (sql_formatted,); and lastly [sql_formatted]
If I manually submit the query as one big long string in sqlite browser, it works. It's just this poncy sqlite3 library forcing me to use the (?,?,?....)format that's causing me grief.
For simplicity, I've completely broken it down:
sql_formatted = [] sql_formatted.append("2018-06-26") sql_formatted.append("my test") sql_formatted.append("1.0") sql_formatted.append("runperiod") sql_formatted.append("Transaction 1") sql_formatted.append(1.776) sql_formatted.append(8.803) sql_formatted.append(15.161) sql_formatted.append(4.138) sql_formatted.append(13.999) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append(15.161) sql_formatted.append(23) sql_formatted.append(0) sql_formatted.append(0) sql_formatted.append('N') try: cur.execute("insert into lr_rundata (current_date, test_name, app_version, test_run_period, transaction_name, '\ 'sla_status, minimum, average, maximum, std_deviation, percentile80, percentile81, percentile82, percentile83, percentile84, '\ 'percentile85, percentile86, percentile87, percentile88, percentile89, percentile90, percentile91, percentile92, percentile93,'\ 'percentile94, percentile95, percentile96, percentile97, percentile98, percentile99, pass, fail, stop, deleted) values '\ '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", sql_formatted)Any suggestions would be more than welcome!!
Kind regards,
Me