[Tutor] problem with simple sqlite script

aivars aivars868 at gmail.com
Fri Nov 7 12:56:30 CET 2008

Kent, Yesss!!

That did the trick! It's worth to remeber.

Thank you very much!


2008/11/7 Kent Johnson <kent37 at tds.net>:
> On Fri, Nov 7, 2008 at 3:49 AM, aivars <aivars868 at gmail.com> wrote:
>> import sqlite3
>> sPath=r'e:\pythonexamples\aivars2.db'
>> con=sqlite3.connect(sPath)
>> cur=con.cursor()
>> cur.execute("insert into test (name) values (?)",sPath)
> The second argument to execute() is a *sequence* of parameter values.
> A string is a sequence of characters, so by passing a plain string you
> are saying that each character of the string is a parameter to the
> SQL.
> Try adding braces around the parameter to make  list:
> cur.execute("insert into test (name) values (?)", [sPath])
> Kent

More information about the Tutor mailing list