Thanks very much for your consideration. There were actually four joins that were done automatically.
It looks like I'd have to use your sqlbuilder library and write a good amount of code on top to do the auto-joining. I'd also have to do without the ORM component completely. Am I understanding correctly? I'm trying to avoid the NIH syndrome, but seem to be failing... Thanks again! --Buck -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oleg Broytmann Sent: Tuesday, August 19, 2008 2:29 AM To: sqlobject-discuss@lists.sourceforge.net Subject: Re: [SQLObject] Can SQLObject do this? Hello! On Mon, Aug 18, 2008 at 04:13:35PM -0700, Golemon, Buck wrote: > The most > bothersome thing to me about ORM's is that they seem to only return data > from one specific table at a time. Well, SQLObject is not better in this aspect - its main .select() method only returns columns from one table. Well, the table could be actually a virtual table - that is, a VIEW, but you have to create the VIEW in advance and describe it in Python using SQLObject's language. > q = db.select("FlowSubTarget", alias(max("FCassy"), "MAX"), "IsRelease") > q.filters( > MetricType = 'i', > Project = 'mario', > Tapeout = 'sa11' > ) > q.add_filter(MaxMTime, ">", "DATE_SUB(NOW(), INTERVAL 10 DAY)") > q.add_filter(FlowSubTarget, "RLIKE BINARY", "'^Sort.*(Stp|Setup)'") > q.add_filter(FCassy, ">=", 0) > q.group_by("FlowSubTarget", "IsRelease") > print q SQLObject classes do not support GROUP BY and a list of columns from different tables (both limitations are for one reason, actually). But there is a lower level mechanism in SQLObject - called SQLBuilder - that can do both. You query would be roughly translated to SQLBuilder's language like this: from sqlobject.sqlbuilder import * columns = ("FlowSubTarget", func.max("FCassy"), "IsRelease") q = [] q.append(Flow.q.id == Names.q.flow) # Do the join q.append(SQLOp(MaxMTime, ">", "DATE_SUB(NOW(), INTERVAL 10 DAY)")) q.append(SQLOp(FlowSubTarget, "RLIKE BINARY", "'^Sort.*(Stp|Setup)'")) q.append(SQLOp(FCassy, ">=", 0)) query = AND(*q) for row in connection.query(connection.sqlrepr( Select(columns, where=query, groupBy=("FlowSubTarget", "IsRelease")) )): print row Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------ - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss