Reputation: 356
I'm having a problem with the binding in this sqlite3 statement in python. Any help would be apreciated. Thanks
print page
print section
cur.execute('SELECT * FROM docList WHERE pageFileName = ? AND sectionTitle = ?',(page,section,))
Here is the output
(u'current_reports.html',)
(u'Intro',)
Traceback (most recent call last):
File "C:\Work\Dropbox\Public\www\propagateIndex.py", line 65, in <module>
cur.execute('SELECT * FROM docList WHERE pageFileName = ? AND sectionTitle = ?',(page,section,))
InterfaceError: Error binding parameter 0 - probably unsupported type.
>>>
I have read a lot of other posts about this but I am not sure what to do still. Tried different
Upvotes: 0
Views: 514
Reputation: 1123400
page
and section
are tuples; you want to insert just the first elements. It's easiest just to concatenate these:
cur.execute('SELECT * FROM docList WHERE pageFileName = ? AND sectionTitle = ?',
page + section)
or use indexing:
cur.execute('SELECT * FROM docList WHERE pageFileName = ? AND sectionTitle = ?',
(page[0], section[0]))
Upvotes: 1