[Python-de] PySQL:DROP DATABASE

Holger Rodriguez python.de at roseng.ch
Son Feb 27 01:40:35 CET 2005


Hallo zusammen,
ich möchte mittels Python-2.4-Programm und PgSQL eine Datenbank
(Client=W2k, Server=Debian, Postgres=V7.4) löschen:

 >>> from pyPgSQL import PgSQL
 >>> connection = PgSQL.connect (host="abc.abc.abc.abc", 
database="template1", user="postgres", password="naja")
 >>> cursor = connection.cursor ()
 >>> cursor.execute ("DROP database household_financials")

Traceback (most recent call last):
   File "<pyshell#6>", line 1, in -toplevel-
     cursor.execute ("DROP database household_financials")
   File "C:\Python24\Lib\site-packages\pyPgSQL\PgSQL.py", line 3072, in 
execute
     raise OperationalError, msg
OperationalError: ERROR:  DROP DATABASE cannot run inside a transaction 
block

Was kann ich noch korrigieren?

connection.autocommit = False
bringt auch nichts....

Vielen Dank.

Gruss,
Holger