Unfortunately this still doesn't solve the main thing I was trying to solve, which was an interface to groupBy select queries on regular SQLObjects. I suppose I could just create a custom view every time I wanted to do one of these queries and then write the SQL out by hand, but I'd rather just have a nice hook-in for it on the regular select method in a SQLObjecty manner. It's more convenient in 99% of my use cases.
- Sean Rick Flosi wrote: > I was thinking about this and database views came to mind. > > Could we handle this problem by creating a database view and using that > object (readonly)? > > Something like (rough syntax): > > class MyView(SQLObject): > class sqlmeta: > _cacheValues = False > _readOnly = True > createSQL = """CREATE VIEW > SELECT mytable.id, SUM(mytable.number) FROM mytable""" > id = ForeignKey('MyTable') > sum = FloatCol() > > > What do you think of this idea? > > > -- > Rick > > On Sun, 6 Aug 2006, Sean McBride wrote: > >> Thanks Oleg. Yeah, I'll try to be more consistent on the names and more >> "spacey" as well. In general I was trying to follow the style guide, >> kinda... >> >> Also, I didn't realize that () was significantly cheaper than [], but I >> suppose that's probably the case. Good point. >> >> I'll continue to work on it. >> >> - Sean >> >> Oleg Broytmann wrote: >>> A few comments about style... >>> >>> On Sat, Aug 05, 2006 at 07:39:11PM -0400, Sean McBride wrote: >>>> + extraColsList = ops.get('extraColumns',[]) >>> Don't hesitate to add an additional space. We do not worry too much >>> about the size of the source. ;) BTW, wouldn't it better to use () instead >>> of creating a new list every time? >>> >>> + extraColsList = ops.get('extraColumns', ()) >>> >>>> + gb = ops['groupBy'] >>> gb? KGB? Don't be shy to write a longer names. ;) >>> >>> + groupBy = ops['groupBy'] >>> >>> + extraColumns = self.select.ops.get('extraColumns', ()) >>> >>> Oleg. >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share your >> opinions on IT & business topics through brief surveys -- and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> sqlobject-discuss mailing list >> sqlobject-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss >> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss