[Tutor] sqlite: does "?" work in PRAGMA commands?

Kent Johnson kent37 at tds.net
Thu Aug 2 18:33:17 CEST 2007


Terry Carroll wrote:
> GET_TABLE_INFO_COMMAND = "PRAGMA TABLE_INFO(?)"
> pragma_cmd = GET_TABLE_INFO_COMMAND
> field_data = self.dbconn.execute(pragma_cmd, (tablename))
> 
> I get the error:
> 
>   sqlite3.OperationalError: near "?": syntax error
> 
> Some of the variations included using "tablename" or "(tablename,)" for 
> the second parameter; it made no difference.

FWIW (tablename,) or [tablename] is the correct spelling, the parameter 
argument must be a sequence.

Kent


More information about the Tutor mailing list