What's the right way to change a database schema using SQLObject? For example, let's say that version one looks like:
class Fleem(SQLObject): data = StringCol() And version two looks like: class Fleem(SQLObject): data = StringCol() last_sent = DateTimeCol() How do I convince SQLObject to issue an ALTER TABLE ADD COLUMN command? You would think that this would be the answer: if not hasattr(Fleem.q, 'last_sent'): Fleem.sqlmeta.addColumn(DateTimeCol("last_sent"), changeSchema=True) But it is not, because at this point, I have already edited the file which contains my model to include the new column, and so the body of the if statement is not run. If it were run, it would give an error, because the column already exists. I could leave the new column out of my model class, but this would mean that people reading that class don't see the full schema. What I want is something like: if not Fleem.sqlmeta.column_actually_exists_in_db('last_sent'): Fleem.last_sent.addToSchema I checked the source code to SQLObject, and didn't see anything relevant. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss