Message144129
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. |
|
Date |
User |
Action |
Args |
2011-09-16 12:34:19 | Mayur.&.Angela.Patel-Lam | set | recipients:
+ Mayur.&.Angela.Patel-Lam |
2011-09-16 12:34:19 | Mayur.&.Angela.Patel-Lam | set | messageid: <1316176459.71.0.201980894918.issue12993@psf.upfronthosting.co.za> |
2011-09-16 12:34:19 | Mayur.&.Angela.Patel-Lam | link | issue12993 messages |
2011-09-16 12:34:18 | Mayur.&.Angela.Patel-Lam | create | |
|