Is there a Python MySQL API that returns Prepared Statements for re-use? -


neither mysqldb nor oursql allow returning prepared statements filled parameters successive executions. there others?

at least .executemany() oursql seems more proficient mysqldb sql statement prepared once submitted values.

(does python support preparation , re-use of prepared statements postgresql?)

for postgresql question, answer there no python-specific way handle prepared statements @ least of last october (i not python programmer common across languages). postgresql offers sql-language way language can use prepared statements if sql queries can executed. code examples on how in python, see http://initd.org/psycopg/articles/2012/10/01/prepared-statements-psycopg/

there couple of major caveats though. 1 of them prepared statements planned on first run, , plan re-used. works great queries same plan uniformly required (say, simple inserts) causes problems parameters might change enough new plans might required. following ok in cases(there still nasty corner cases aware of):

  1. insert foo (bar) values ($1)
  2. select * foo bar= $1; assuming bar primary key

something following may not safe:

  1. select * foo bar < $1
  2. select * foo baz = $1 baz may have significant portion of rows same value.

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -