This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mayur.&.Angela.Patel-Lam
Recipients Mayur.&.Angela.Patel-Lam
Date 2011-09-16.12:34:18
SpamBayes Score 7.5574935e-11
Marked as misclassified No
Message-id <1316176459.71.0.201980894918.issue12993@psf.upfronthosting.co.za>
In-reply-to
Content
The sqlite3 module is wonderful, but the one advantage that C/C++ coders have using that system is the ability to use precompiled/prepared SQL statements.  Some SQL databases like Postgresql allow you to precompile statements using special SQL statements (e.g. PREPARE), so there is no need to change the python DBI for those database systems.  But unfortunately, sqlite3 only offers a C/C++ function, which returns a handle to the prepared statement.  I have sought a way to call this from the python DBI, but I simply don't think it's exposed.

Since my application interleaves several SQL commands, depending on the results of the last iteration, I can't immediately use executemany() to obtain maximum performance on my code.  Precompiled statements offer me the best opportunity to optimize.  I can prepare the 2 or 3 most expensive queries in my loop and call them in whatever order I need.  There are some estimates that prepared statements can accelerate complex queries by an order of magnitude, as the parser and optimizers don't need to come into play for every call.

Would you consider an extension to the sqlite3 DBI to expose prepared statements?  Thanks.
History
Date User Action Args
2011-09-16 12:34:19Mayur.&.Angela.Patel-Lamsetrecipients: + Mayur.&.Angela.Patel-Lam
2011-09-16 12:34:19Mayur.&.Angela.Patel-Lamsetmessageid: <1316176459.71.0.201980894918.issue12993@psf.upfronthosting.co.za>
2011-09-16 12:34:19Mayur.&.Angela.Patel-Lamlinkissue12993 messages
2011-09-16 12:34:18Mayur.&.Angela.Patel-Lamcreate