Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:37:05+00:00 2026-05-24T11:37:05+00:00

Upon adding a second foreign key to the same table I get the following

  • 0

Upon adding a second foreign key to the same table I get the following error:

Please specify the 'onclause' of this join explicitly.

How can I specify this relationship?

class Parent(Base):
    First = Column(Integer, ForeignKey('Child.Ex1'))
    Second = Column(Integer, ForeignKey('Child.Ex2'))

class Child(Base):
    Ex1 = Column(Integer)
    Ex2 = Column(Integer)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:37:07+00:00Added an answer on May 24, 2026 at 11:37 am

    (ed. note: pep8 recommends naming class attributes starting with lowercase…just a convention)

    class Parent(Base):
        __tablename__ = "Parent"
        id = Column(Integer, primary_key=True)
        first = Column("First", Integer, ForeignKey('Child.Ex1'))
        second = Column("Second", Integer, ForeignKey('Child.Ex2'))
    
        first_child = relationship("Child", primaryjoin="Parent.first==Child.ex1")
        second_child = relationship("Child", primaryjoin="Parent.second==Child.ex2")
    
    class Child(Base):
        __tablename__ = "Child"
        id = Column(Integer, primary_key=True)
        ex1 = Column("Ex1", Integer)
        ex2 = Column("Ex2", Integer)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have stumbled upon a problem when adding a button to my table view
Upon a click on an IMG, I would like to get to the next
Upon AD Import for SharePoint, MOSS does this automatically: Office SharePoint Server 2007 automatically
With jquery, I'm dynamically adding rows. To do this, I'm copying the first of
Upon page load I want to move the cursor to a particular field. No
Expanding upon my earlier problem , I've decided to (de)serialize my config file class
Once upon a time I read how you detect programmatically for mounted NTFS folders
I have a page upon which a user can choose up to many different
I've recently embarked upon the grand voyage of Wordpress theming and I've been reading
I happened upon a brief discussion recently on another site about C# runtime compilation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.