> t = Table('mytable', meta,
>                 Column(...)
>         ....
> )
>
> someothermeta = MetaData()
> t2 = Table('mytable', someothermetadata, autoload=True,
> autoload_with=<connection>)
>
> assert t.compare(t2)

I believe this should be done somehow automatically. Because everyone
needs this. There should be two separate disjoint options:

1) Autoload, when working with previously created database for rapid
start. Columns arent specified at all in Python code (SQLAlchemy).
2) Tables are specified in the code. Database tables might already
exist and might not. And when issuing create_all(), all the situations
should be handled correctly:
2a) If tables exist in DB and match Python-defined, ok.
2b) If tables do not exist in DB they are created, ok.
2c) If tables exist in DB and there is mismatch with Python-defined,
an exception is raised.

If feel this is kind of natural. Though, I am not an expert in DB or
SQLAlchemy.

> but why not just use autoload=True across the board in the first
> place and eliminate the chance of any errors ?

1) I dont know if tables exist. I might need to create them.
2) When they exist, autoloading them might cause inconsistency with
SQLAlchemy-defined tables in sources. This is exactly what I am trying
to avoid.


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