ponyorm / pony

Pony Object Relational Mapper
Apache License 2.0
3.58k stars 242 forks source link

how to add a condition in "ON" cause of "LEFT JOIN" in PonyORM? #696

Open johnson329 opened 7 months ago

johnson329 commented 7 months ago

SELECT af.AppFormID, af.AppFormTitle, ra.CreateGrant, ra.ReadGrant, ra.UpdateGrant, ra.DeleteGrant, ra.PrintGrant FROM public.appforms as af left join public.roleaccesses as ra on af.appformid = ra.appformid and ra.roleid = 2

query= orm.left_join((af.AppFormID, af.AppFormTitle, ra.CreateGrant, ra.ReadGrant, ra.UpdateGrant, ra.DeleteGrant, ra.PrintGrant) for af in AppForms for ra in af.RoleAccess if ra.RoleID.RoleID == id)

But, "if" is known as "WHERE" cause. How can I solve this problem?