I was surprised when I recently discovered I had to add an extra
underscore to use a SQLObject class's foreign key ID when using
sqlobject.sqlbuilder.Outer. For example, this works:
EXISTS(Select(Foo.q.id, where=Outer(Bar).q.foo_ID == Foo.q.id))
This does not work:
EXISTS(Select(Foo.q.id, where=AND(Outer(Bar).q.fooID == Foo.q.id)))
I've posted an example as a Gist here:
https://gist.github.com/RhubarbSin/5785040
(That code doesn't represent the way I would normally perform a query;
I encountered the issue in a subquery of a much larger one.)
|