Re: Exception: "VACUUM cannot run inside a BEGIN/END block"
Adam Buraczewski <[email protected]> Sun, 30 Nov 2003 13:50:21 +0100
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Nov 29, 2003 at 06:13:35PM +0100, Karsten Hilbert wrote:
> cursor.execute('end;vacuum analyze;begin;')
> we use this successfully around "create database"
Don't you have a feeling it's a bit ugly? ;-) DBI, and especially
cursor objects, weren't invented for DDL commands, only for DMLs.
Personally, I think that DBI spec should be somehow enhanced so that
it would cover such situations. As an acceptable solution I usually
use plain libpq module here. The goal can be achieved with following
code:
from pyPgSQL import PgSQL
conn = PgSQL.connect(...)
...
conn.conn.query("vacuum analyze")
Of course it will work with pyPgSQL only :^)
Best regards,
--
Adam Buraczewski <adamb (at) nor (dot) pl> * Linux user #165585
GCS/TW d- s-:+>+:- a C+++(++++) UL++++$ P++ L++++ E++ W+ N++ o? K w--
O M- V- PS+ !PE Y PGP+ t+ 5 X+ R tv- b+ DI D G++ e+++>++++ h r+>++ y?
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/