Re: [SQLObject] Checking if a table exists ?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Markus J. <mar...@ya...> - 2004-09-20 07:36:34
|
thanks.this is what I was looking for.
regards
markus
--- Ian Bicking <ia...@co...> schrieb:
> 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
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE.
> Be one of 170
> Project Admins to receive an Apple iPod Mini FREE
> for your judgement on
> who ports your project to Linux PPC the best.
> Sponsored by IBM.
> Deadline: Sept. 24. Go here:
> http://sf.net/ppc_contest.php
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
>
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
|