On Feb 12, 2008, at 12:34 PM, Chris Withers wrote:

>
> Paul Johnston wrote:
>> SA will only try to create table when you tell it - either  
>> table.create() or
>> metadata.create_all()
>
> ...and what happens if these methods are called and the tables already
> exist?
>
> What if they exist but don't match the spec that SA has created?

just try it out...create_all() by default checks the system tables for  
the presence of a table first before attempting to create it (same  
with dropping).  this is controlled by a flag called "checkfirst".

it the table exists, nothing is created.  theres no "comparison" which  
takes place between the table in the DB and whats defined in your  
application.

if you're concerned about people running your application against  
databases created from a different version and then failing, I would  
suggest adding a "version" table to your database which contains data  
corresponding against the version of your application in some way.   
There has been interest among some SA users over building a generic  
"schema comparison" system and I think even some prototypes are  
available, though I think thats a fairly complicated and unreliable  
approach to take for this particular issue.


--~--~---------~--~----~------------~-------~--~----~
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