Re: [SQLObject] Filtering selections via foreign keys
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Jason H. <jas...@gm...> - 2011-02-17 01:23:44
|
On 16 February 2011 17:05, Oleg Broytman <ph...@ph...> wrote: > If SVNDocument is actually Document in this example, and type to > filter must be compared equal to DocumentType.dbType Ah yes, sorry about those errors. > docs.filter( > (Document.q.dbDocumentTypeID==DocumentType.q.id) & > (DocumentType.q.dbType==type) > ) I still can't get this to work — even if I set "type" to something that doesn't match anything in the table, the filter has no effect — the count of results is the same before and after, when I'd expect it to be zero for a type not in the table. (I've checked that it goes through that "if", too.) I also changed the dbDocumentTypeID to dbDocumentType with no luck (what's the difference between the two? I notice the same naming change in the j-magic section of the docs). One of the other things I tried is to use a j-magic expression: Document.j.dbDocumentType & (DocumentType.q.dbType==type) ... but still nothing happens to the select result. I've been trying to construct an "IN" query, but haven't really gotten anywhere with that yet either. Any other suggestions? Cheers, Jason |