[Tutor] Squlite3 problem
Jason Massey
jason.massey at gmail.com
Tue Mar 13 13:13:54 CET 2007
I found a similar discussion on the pysqlite mailing list (
http://lists.initd.org/pipermail/pysqlite/2005-August/000127.html)
Try committing your changes and then closing your cursor.
db.commit()
cur.close()
db.close()
On 3/13/07, Jim Roush <ja_roush at mminternet.com> wrote:
>
> I'm geting the following error message and I'm stumped
>
> Traceback (most recent call last):
> File "C:\markets\source\QuantScan\QuantScan4_3.py", line 1362, in
> <module>
>
> db.close()
>
> sqlite3.OperationalError: Unable to close due to unfinalised statements
>
>
>
> Here 's the relevant code
>
> db = sqlite.connect('c:/markets/db/market_2.db')
> cur_stocks = db.cursor()
> cur_quant = db.cursor()
> cur_subind = db.cursor()
>
> # update ROC table in db
> print '\nupdate ROC table in db...\n'
> cur = db.cursor()
> cur.execute("delete from subind_ROC")
>
> for row in range(0, num_of_subinds):
> (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2, si_ROC_20,
> si_ROC_20_1, \
> si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2) =
> si_ROC[row]
>
> cur.execute("INSERT INTO subind_ROC (subind, ROC_10, ROC_10_1,
> ROC_10_2, ROC_20, ROC_20_1, ROC_20_2, ROC_30, ROC_30_1, ROC_30_2) Values
> (?,?,?,?,?,?,?,?,?,?)", (subind, si_ROC_10, si_ROC_10_1, si_ROC_10_2,
> si_ROC_20, si_ROC_20_1, si_ROC_20_2, si_ROC_30, si_ROC_30_1, si_ROC_30_2))
>
> cur.close()
> db.commit()
> db.close()
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070313/d0c7db5e/attachment.html
More information about the Tutor
mailing list