incorrect binding errors.

"Eric S. Johansson" <[email protected]>
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
     def convert(self,external_ID):
         """Convert external id to the twopenny blue ID"""
         print select_cmd, external_ID
         candidates = self.cursor.execute('select * from 
external_internal where (external_ID="?") ;',external_ID)
         result = candidates.fetchone()
         if result is not None:
             return result[1]
         return None
yields

debug: /tmp/sample
debug: select * from external_internal where (external_ID=?) ;
debug: [email protected]

Traceback (most recent call last):
   File "db_utils.py", line 340, in ?
     main2()
   File "db_utils.py", line 337, in main2
     res = ts.convert('[email protected]')
   File "db_utils.py", line 181, in convert
     candidates = self.cursor.execute("select * from external_internal 
where (external_ID='?') ;",external_ID)
pysqlite2.dbapi2.ProgrammingError: Incorrect number of bindings 
supplied. The current statement uses 0, and there are 15 supplied.

if I eliminate the quotes from around the ?, it tells me:

Traceback (most recent call last):
   File "db_utils.py", line 340, in ?
     main2()
   File "db_utils.py", line 337, in main2
     res = ts.convert('[email protected]')
   File "db_utils.py", line 181, in convert
     candidates = self.cursor.execute("select * from external_internal 
where (external_ID=esj) ;")
pysqlite2.dbapi2.OperationalError: no such column: esj


which is correct as far as it goes but why is it looking for a column 
called esj?  esj s a fragment of what I'm looking for in a table

table definition.

external_internal = '''
external_ID         TEXT PRIMARY KEY,
internal_ID         TEXT
'''

this will probably make more sense in the morning but for now it's --- 
help??

--- eric
-- 
Speech-recognition in use.  It makes mistakes, I correct some.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.