Re: [SQLObject] Altering/updating a database
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Petr J. <pet...@tp...> - 2011-01-14 00:57:46
|
> It could be as simple as > > Table.sqlmeta.addColumn(UnicodeCol('name'), changeSchema=True) > > Yes we are using addColumn method and it works great (Firebird SQL). The other question still remains: "How to find if the table was updated already". We are maintaining hundreds of the databases with the same structure on different machines and we were not sure where the table was already updated and where not. Because of that, we were using following (but I do not know if it is the best way):? from kinterbasdb import ProgrammingError try: Table.select()[0] except IndexError: # this means table Table is OK, new column(s) was created already, no data in the column pass except ProgrammingError: Table.sqlmeta.addColumn(UnicodeCol('name'), changeSchema=True) Cheers Petr |