>
> you should be able to say:
>
> table = Table('account_stuff', metadata,
> Column('account_id', Integer, ForeignKey('account_ids.account_id'),
> primary_key=True),
> autoload=True)
>
That doesn't appear to work unfortunately. When I load the db and
create the two tables and then attempt to do a join:
join(account_ids_table, account_stuff_table)
I get the error:
<class 'sqlalchemy.exceptions.ArgumentError'>: Can't determine join
between 'account_ids' and 'account_stuff'; tables have more than one
foreign key constraint relationship between them. Please specify the
'onclause' of this join explicitly.
Looking at account_stuff_table.foreign_keys I have:
OrderedSet([ForeignKey(u'account_ids.account_id'),
ForeignKey('account_ids.account_id')])
I'm guessing the load duplicated the key. Although I only have two
columns looking at list(account_stuff.c)
[Column(u'credit',SLNumeric(precision=10,length=2)),
Column('account_id',Integer(),ForeignKey('account_ids.account_id'),primary_key=True,nullable=False)]
Thanks
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---