Alexander Alexander - 10 months ago 126
SQL Question

how to make join after where condition with peewee

Is that possible making join after where condition like that

query = (AppCompany

if request.args.industry:
query = query.switch(AppCompany).join(AppCompanyToIndustry)
query = query.where(AppCompanyToIndustry.industry_id==request.args.industry)

I tired but it throwed this error : "ValueError: A join condition must be specified."


Provide a join condition

query = query.switch(AppCompany)
             .where(AppCompanyID == AppCompanyToIndustryID)

Here you should replace AppCompanyID and AppCompanyToIndustryID with proper column