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


T

Tim Chase

A list instead of a tuple does work, but not an iterable, so
'sequence'.

In the OP's case using sqlite drivers, this is true. However, I
maintain some old 2.4 code that uses a correspondingly ancient version
of mx.ODBC which requires a tuple and raises an exception on any other
iterable. So I always use a tuple out of habit, even if it would be
easier to just use some other iterable.

-tkc
 
Ad

Advertisements

R

Rustom Mody


Thanks for that!

I would have preferred a slightly louder warning with respect to singleton
tuples given that:

1. Singleton tuple syntax is not consistent with other-length tuples
2. This inconsistency is somewhat alleviated by the fact that in a classic
format ('%') expression, the second argument can be a single element when the
format string has only one %-spec -- so one inconsistency to correct another
3. conn.execute's parameters, apparently very analogous to the '%'
-- even more so given the standard sql-injection advisory -- is not consistent
with 2 above

Still the suggested doc-fix is much better than the current almost
undocumented situation -- so thanks again!
 
Ad

Advertisements

T

Terry Reedy

In the OP's case using sqlite drivers, this is true. However, I
maintain some old 2.4 code that uses a correspondingly ancient version
of mx.ODBC which requires a tuple and raises an exception on any other
iterable. So I always use a tuple out of habit, even if it would be
easier to just use some other iterable.

I would check 2.7 behavior before changing the 2.7 doc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top