You want something like this:

user_table = Table('users', metadata, Column('userid', String(8)))
user_table.create(checkfirst=True)
# or 
# metadata.create_all(checkfirst=True)

Documentation is at:

http://www.sqlalchemy.org/docs/metadata.html#metadata_creating

Hope that helps,

Simon

> -----Original Message-----
> From: sqlalchemy@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of samwyse
> Sent: 27 July 2007 13:23
> To: sqlalchemy
> Subject: [sqlalchemy] lazy table creation
> 
> 
> I've looked and looked, but can't find any guidance on this.  I want a
> program that, the first time it's run, creates its tables.  I'm
> guessing that I need something like this:
> 
> try:
>   user_table = Table('users', metadata, autoload=True)
> except NoSuchTableError:
>   user_table = Table('users', metadata, Column('userid', String(8)))
> 
> OTOH, I can't find any examples of anyone doing things this way.  Is
> there another way that I'm missing?  Thanks!
> 
> 
> > 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to