#2221: wrap db upgrade scripts in a transaction
------------------------+----------------------
Reporter: dustin | Owner:
Type: enhancement | Status: closed
Priority: major | Milestone: 0.8.6
Version: 0.8.5 | Resolution: wontfix
Keywords: database |
------------------------+----------------------
Comment (by exarkun):
Actually, SQLite3 does support schema modifications as part of
transactions:
{{{
>>> from sqlite3 import connect
>>> connection = connect(':memory:', isolation_level=None)
>>> cursor = connection.cursor()
>>> cursor.execute('BEGIN IMMEDIATE TRANSACTION')
<sqlite3.Cursor object at 0x27ac650>
>>> cursor.execute('CREATE TABLE foo ( a integer, b integer )')
<sqlite3.Cursor object at 0x27ac650>
>>> cursor.execute('COMMIT')
<sqlite3.Cursor object at 0x27ac650>
>>> cursor.execute('BEGIN IMMEDIATE TRANSACTION')
<sqlite3.Cursor object at 0x27ac650>
>>> list(cursor.execute('SELECT * FROM foo'))
[]
>>> cursor.execute('DROP TABLE foo')
<sqlite3.Cursor object at 0x27ac650>
>>> cursor.execute('ROLLBACK')
<sqlite3.Cursor object at 0x27ac650>
>>> list(cursor.execute('SELECT * FROM foo'))
[]
>>>
}}}
The pysqlite2 interface to this functionality is rather obtuse, and the
documentation is very unclear on the matter, which I suppose is why you
thought it did not work. At the actual SQLite3 layer the support is quite
solid, though, and has been present for many years.
--
Ticket URL: <http://trac.buildbot.net/ticket/2221#comment:2>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Buildbot-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/buildbot-commits