paul kölle wrote:
>> now I want to check everytime I start my programm
>> if the table already exists and if not it should
>> be created.
>
> Author.createTable(ifNotExists=True)
Besides this you can also do __connection__.tableExists('author'). And
you could try something like:
if __connection__.tableExists('author'):
class DBAuthor(SQLObject):
_table = 'author'
_fromDatabase = True
And then you could compare DBAuthor._columns with Author._columns, to
make sure the schema was up-to-date. From there you might just signal
an error if not, or you could try to do something more sophisticated.
But be warned that this introspection is getting into undocumented
portions of SQLObject, that might change in the future.
--
Ian Bicking / ia...@co... / http://blog.ianbicking.org
|