title: Could not locate foreign key columns for primary join condition
body: <p>I have created the following database definitions and test data:</p>
  
  <pre><code>from sqlalchemy import Column, Integer, String, ForeignKey
  from sqlalchemy.orm import relationship
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy.orm.session import sessionmaker
  Base = declarative_base()
  # build dynamic table
  cols = {'__tablename__': 'mytable', 'A': Column(String, primary_key=True), 'B': Column(Integer)}
  table = type('mytable', (Base,), cols)
  cols2 = {'__tablename__': 'mychild', 'A': Column(String, primary_key=True), 'Z': Column(Integer)}
  cols2['parent_id'] = Column(String, ForeignKey('mytable.A'))
  child_table = type('mychild', (Base,), cols2)
  child_table.parent = relationship('mytable', backref='mytable', primaryjoin='mytable.A==mychild.A')
  # initialize engine
  from sqlalchemy import create_engine
  engine = create_engine('sqlite:///', echo=True)
  Base.metadata.create_all(engine)
  # generate a toy dataframe and dump to sql
  import pandas as pd
  df = pd.DataFrame.from_dict({'B': {'row1': 1}})
  df.to_sql('mytable', engine, if_exists='append', index_label='A')
  Session = sessionmaker(bind=engine)
  session = Session()
  session.query(child_table)
  </code></pre>
  
  <p>And this leads to the error</p>
  
  <pre><code>ArgumentError: Could not locate any relevant foreign key columns for primary join condition 'mytable."A" = mychild."A"' on relationship mychild.parent.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or are annotated in the join condition with the foreign() annotation.
  </code></pre>
  
  <p>In general, I am confused on how I can write queries against my tables. In this case, how would I do something like <code>select * from mytable</code> or even more useful <code>SELECT B,Z from mytable JOIN mychild using A</code>, which is what I am really trying to achieve through this.</p>