explicitly specify the columns:

entity = Table('entity', meta,
        Column('somecol', ForeginKey('user.id'))
        autoload=True
)

On Apr 5, 2007, at 10:46 AM, mike nelson wrote:

>
> Could someone explain how I could do the following:
>
> #None of these tables have foreign keys defined in the database
> entity = Table('entity',meta,autoload=True)
> user = Table('user',meta,autoload=True)
>
> class Entity(object):
>     pass
>
> class User(Entity):
>     pass
>
> m_entity = mapper(Entity,entity)
>
> #this raises an exception because there are no foreign keys defined
> between entity and user
> m_user = mapper(User,user,inherits=m_entity)
>
> Is there a way I can still use autoload (these tables have a lot of
> columns and they change somewhat frequently) and explicitly add a
> foreign key relationship between the two and allow for inheritance?
>
> Thanks in advance
>
>
> >


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