SQLite Forum

Virtual tables query closes cursor too early when no rows returned
Login
You should examine the code for pysqlite2 to find out why this is happening.  I don't think it has anything whatsoever to do with SQLite3.

From SQLite3's perspective, the a statement (VDBE program) was created when the .execute() method was called, and then is was executed with sqlite3_exec.  In both cases the VDBE program (statement) ran to completion without producing any rows (returned SQLITE_DONE) and the statement (VDBE program) was reset (but not yet finalized) and is in the non-executing state the same as between the sqlite3_prepare and the first sqlite3_exec call.

In this state, metadata from the compiled statement will be available.  Information regarding the "current row" will not (there is no current row).  In the case of "virtual tables" even such calls as are attempting to retrieve the statement (VDBE program) metadata may fail (technically, there is none, since the virtual tables are no longer "connected" and therefore not subject to introspection).  How pysqlite2 handles this I do not know.  An examination of the pysqlite2 source code would have to be made to determine this.

In other words, except in the case where a row is returned I would not expect that the .description method would be able to return any data.  Why would you expect a description to be available for a query that produces no rows?