Help: Omitting quotes from SQL Queries.

Daniel Dittmar daniel at
Wed Jan 8 13:28:07 CET 2003

keithk wrote:
> Daniel,
> Could you give me a little more detail about the
> execute ("SELECT ...",[fileName]) appraoch as I am not familiar with
> the syntax.

for fileName in fileNameList:
         cursor.execute("""SELECT fileSize FROM database where
         database.filename = ?""",  [fileName])
         fileSizes = cursor.fetchall()

The driver is responsible for replacing the ? with the actual value.

Python drivers differ in the kind of placeholders they accept, but 
mxODBC should work fine with the question mark.


More information about the Python-list mailing list