2 Database update scripts for usage with B{dak update-db}
4 @contact: Debian FTP Master <ftpmaster@debian.org>
5 @copyright: 2008 Michael Casadevall <mcasadevall@debian.org>
6 @license: GNU General Public License version 2 or later
8 Update scripts have to C{import psycopg2} and
9 C{from daklib.dak_exceptions import DBUpdateError}.
11 There has to be B{at least} the function C{do_update(self)} to be
12 defined. It should take all neccessary steps to update the
13 database. If the update fails the changes have to be rolled back and the
14 C{DBUpdateError} exception raised to properly halt the execution of any
19 print "Doing something"
23 c.execute("SOME SQL STATEMENT")
26 except psycopg2.ProgrammingError, msg:
28 raise DBUpdateError, "Unable to do whatever, rollback issued. Error message : %s" % (str(msg))
30 This function can do whatever it wants and use everything from dak and