My methods are more complex than simple ZSQL lookups. I need to do a tree traversal through a database to get the relevant items to display. So I need to do nested SQL queries.The first Zope attempt was ;
<dtml-var standard_html_header> <dtml-if child><dtml-var show_html> <dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html> <dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html> <dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html> <dtml-in expr="Actors.SQL.get_children(parent=child)"><dtml-var show_html></dtml-in get_children L4></dtml-in get_children L3></dtml-in get_children L2></dtml-in get_children L1> <dtml-else> <form action='cascade2' method=post> child <input type=text name=child size=10> </form> </dtml-if> <dtml-var standard_html_footer>
That is, it's a nested loop of ZSQL methods and show_html is an external method that displays HTML dependant on the contents of a DTML document in the ZODB (this is *so* cool - I can change the look and feel of 'elements' with triviality...) It took about 27 seconds to render a (120k) document.
Using a full External Method solution, with calls to DBH.query (and a one-time lookup for all the DTML 'templates' in the ZODB) it took about 2 seconds (it's not completely debugged though! :).
So, I'm *not* calling ZSQL methods from an External method, I'm using direct connections to the database using Python libraries. Obviously, I lose a lot of Zope goodies here, but I really need that speedup...
So, if I understand you correctly, your EM's call query on the DA object itself, not using the ZSQL Methods. Then you have no cache whatsoever on those queries. Is there no way you can use a ZSQL Method here anyway? Just a self.nameOfZSQLMethod(arguments) might speed things up here. Also, I don't know how your recursive query will work within the one thread of a HTTP request. What python libraries do you use? -- Martijn Pieters, Software Engineer | Digital Creations http://www.digicool.com | Creators of Zope http://www.zope.org | mailto:mj@digicool.com ICQ: 4532236 | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 -------------------------------------------