On Jul 15, 2006, at 3:52 PM, Michael Carter wrote: > To keep the extension from loading data beyond the id, a hook will > be placed at the end of Query.compile so the sql query can be > modified to forget about those extra columns. Quick question, under > what circumstance, if any, will the next two lines (which come > after the place where the hook would go) add more columns besides > the id? > > # give all the attached properties a chance to modify the query > for key, value in self.mapper.props.iteritems(): > value.setup(key, statement, **kwargs) >
those lines are the lines that put the columns into the query. the extension would be like: if extension.compile_columns(....) is EXT_PASS: for key, value in self.mapper.props.iteritems(): value.setup(key, statement, **kwargs) > As for caching objects, the Proxy object can get its data from > wherever it wants when its class changes to the real version. > > Now as for caching the results of a select, this is the clearest > way I can see to do it. Override Query.select via MapperExtension. > This can check the cache first for results. if it can't find the > results in the cache, it returns sqlalchemy.orm.EXT_PASS. if it > does, it creates a list of proxy instances out of the result and > returns them. > oh, you *do* want to cache the queries as well eh ? i would consider this a separate function from the proxy object thing. I can definitely see people wanting the proxy object functionality without using a cache. i would just do it the way SelectResultsExt does it in selectresults.py, using select_whereclause to actually query the DB. ------------------------------------------------------------------------- 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 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users