title: Flask SqlAlchemy join two models without foreign key MYSQL
body: <p>I am joining two models without a foreign key:</p>
  
  <p>Models:</p>
  
  <pre><code>class Users(db.Model):
      __tablename__ = "Users"
      userName = db.Column(db.String, primary_key=True)
      lastLogin = db.Column(db.DateTime)
  
  class TimeOff
      __tablename__ = "timeOff"
      timeOffID = db.Column(db.Integer, primary_key=True)
      userName = db.Column("userName", db.String,   db.ForeignKey('appUsers.userName')),
      dayWork = db.Column(db.DateTime)
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>result = db.session.query(models.Users).join(models.TimeOff)
  </code></pre>
  
  <blockquote>
    <p>sqlalchemy.exc.InvalidRequestError: Could not find a FROM clause to join from.
     Tried joining to but got: Can't find any foreign key relationships between 'TimeOff' and 'Users'.</p>
  </blockquote>
  
  <p>I dont have a foreign key defined in table</p>