[PonyORM-list] The docs don't seem to cover this query type
Matthew Bell
matthewrobertbell at gmail.com
Sun Feb 16 13:26:14 UTC 2014
Say I have 2 entities with a one to many relationship:
class A(db.Entity):
bs = set('B')
class B(db.Entity):
a = Required('A')
status = Required(unicode)
I then want to query for all "A", that have Bs that all have the status
"whatever".
How I assumed it could be done:
select(a for a in A if a.bs.status == 'whatever')
or
select(a for a in A if all(b.status == 'whatever' for b in a.bs))
But neither work. What is the "pony way" of doing this?
A python example of what I mean (I obviously would like to do it properly
all in pony though):
for a in models.A.select():
if all(b.status == 'whatever' for b in a.bs):
yield a
Thanks in advance for any guidance.
--
Regards,
Matthew Bell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20140216/af45c0fd/attachment.html>
More information about the ponyorm-list
mailing list