hi don - heres a script using SQLite which illustrates how the foreign key reflection works. This same sort of thing should be working on MS-SQL as well but I dont have access to an MS-SQL server here to test. If the example below is not working for MS-SQL, please file a trac ticket - we have some MS-SQL developers who can take a look.
- mike from sqlalchemy import * engine = create_engine('sqlite:///', echo=True) metadata = MetaData(engine) Table('t1', metadata, Column('id', Integer, primary_key=True), Column('name', String(60))) Table('t2', metadata, Column('id', Integer, primary_key=True), Column('t1_id', Integer, ForeignKey('t1.id')), Column('name', String(60))) metadata.create_all() meta2 = MetaData(engine) # reflect t2, t1 gets loaded too t2 = Table('t2', meta2, autoload=True) assert 't1' in meta2.tables assert meta2.tables['t1'].c.id.primary_key # reflect an entire DB meta3 = MetaData(engine) meta3.reflect() print [t for t in meta3.tables] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---