0

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

1 Answer 1

1

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]))
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much, I always struggle with that!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.