flask sqlalchemy非外键连接两个表

AB表内连接

query = database.session().query(models.A, models.B) 
query = query.join(models.B, models.B.xx== models.A.xx).filter(models.a.xx== '20180615-20180621').filter(models.b.xx= 'haha') 
data = query.all()

你可能感兴趣的:(flask sqlalchemy非外键连接两个表)