problem with sqlite3: cannot use < in a SQL query with (?)

Tim Chase python.list at tim.thechases.com
Wed Jan 22 22:05:58 EST 2014


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,))

-tkc






More information about the Python-list mailing list