Don't know how you are rendering this; but if this a web app, you could make an Ajax call which fires off the query, draw the grey bar, and have the callback from the Ajax query then render the results when they are ready..
On Sep 13, 2007, at 11:26 AM, Koen Bok wrote: > > Hi, I am doing some optimizations on our app, and one thing I was > wondering is if I can have a lazy relation loading in a separate > thread. > > The way I'd like to use it is like this. I have a list with products, > and these products show a graph with stock levels. To draw this graph, > the object fetches it's relation stock. The stock object is built like > this: > > SELECT > amount - (SELECT sum(qty) FROM orders WHERE > id_product=stock.id_product) as available > FROM stock > WHERE id_product=1234; > > This is because we need to correct stock levels with the already > placed orders to get a good idea of availability. > > This query takes fairly long (depending on the orders) so I'd like to > draw a gray bar initially, start a thread to fetch the stock object > and draw it once we have that result. Is this possible? If so, can > anyone give me a hint how to start? > > Thanks, > > Koen > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---