sqlite3 docbug (was problem with sqlite3)

Rustom Mody rustompmody at gmail.com
Wed Jan 22 23:33:43 EST 2014


On Thursday, January 23, 2014 8:35:58 AM UTC+5:30, Tim Chase wrote:
> On 2014-01-23 03:32, lgabiot wrote:
> >  >>>cursor = conn.execute("SELECT filename, filepath  FROM files
> >  >>>WHERE   
> > max_level<(?)", threshold)
> > that doesn't work (throw an exception)

> That last argument should be a tuple, so unless "threshold"
>  is a tuple, you would want to make it

>   sql = "SELECT ... WHERE max_level < ?"
>   cursor = conn.execute(sql, (threshold,))

Seeing this is becoming a faq I looked at the docs to see if the tuple second
argument could do with some more emphasis

I think it sure could; see
http://docs.python.org/2/library/sqlite3.html#sqlite3.Cursor

The builtin connection.execute is even less helpful



More information about the Python-list mailing list