From: Andrew M. <an...@ob...> - 2005-04-20 03:51:20
|
>> If I attempt to: >> cursor.execute('create database blah...') >> I get the following error: >> libpq OperationalError: ERROR: CREATE DATABASE cannot run inside a >> transaction block >> >> How can I accomplish my objective? > >Here's one way to do it, though kludgey: > cursor.execute('commit') # note that this closes our transaction, so >that the following works: > cursor.execute('create database blah') The method I use is: db = PgSQL.connect(...) db.autocommit = True curs = db.cursor() curs.execute('....') db.close() -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/ |