ForeignKey has ".column" as the column it refers to, and .parent as the column 
that is constrained to that ".column".


On Oct 3, 2013, at 3:18 PM, tiadobatima <gbara...@gmail.com> wrote:

> Hello there,
> 
> I'm wondering if there is an easy way of finding the local column name given 
> a ForeignKey. For example, the snippet below just gives me the remote column 
> name:
> 
> for fkey in meta.tables['mytable'].foreign_keys:
>     print fkey.column
> 
> I understand I could iterate over all the columns of the local table to find 
> which has a foreign key, but I imagine there is a more direct way.
> 
> Thanks! :)
> g.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to