Python - sqlite3 cannot select right after update-commit - works on retry

十年热恋 提交于 2020-01-17 06:05:57

问题


tst = dbConnection.execute("SELECT nameshort, namefull, timelastpostsecs, qtypostlasttime 
FROM " + tableToUse + " WHERE compid = ?", (str(row['compid']),))

Give following error when run 3rd time in cycle where row is different each time:

sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

Select is run right after update - commit to check update.

When I copy code from error message and execute it again in IDE Python (where I run script), it works w/out error.

What could it mean? I understand I can add try and then retry in case of exception, still maybe there is better way.

ADDED: added try: and see that error persists at each cycle loop after 3rd update. After waiting 5 seconds and trying again select works. So kind of for this code (which is not time critical) issue is worked around. Still I'm interested if it's known issue with sqlite.

来源:https://stackoverflow.com/questions/38414530/python-sqlite3-cannot-select-right-after-update-commit-works-on-retry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!