470,849 Members | 1,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

query progress bar

is it possible to mke a progress bar for queries? say i have a query
that will take 20 seconds, i'd like to give some feed back to users on
how long this will take.
Jul 19 '05 #1
8 2902
What type of UI is this for? The Python Cookbook, 2nd Ed. has a nice
textual solution. I'm not sure if this is the same one, but here is <a
href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639">one
from ASPN</a>. Here is one <a
href="http://wxpython.org/docs/api/wx.ProgressDialog-class.html"> for
wxPython.</a>

Jul 19 '05 #2
ry**@ryankaskel.com wrote:
What type of UI is this for? The Python Cookbook, 2nd Ed. has a nice
textual solution. I'm not sure if this is the same one, but here is <a
href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639">one
from ASPN</a>. Here is one <a
href="http://wxpython.org/docs/api/wx.ProgressDialog-class.html"> for
wxPython.</a>

it's for wx, the problem isn't making the progress bar itself, it's
knowing how long the query is going to run for.
i'm using pypgsql
Jul 19 '05 #3
> it's for wx, the problem isn't making the progress bar itself, it's
knowing how long the query is going to run for.
i'm using pypgsql


It is quite easy:

from timemachine import oracle

guesser=oracle(guess="SQL")
guesser.set_hint(driver="pypgsql")
guesser.set_hint(gui="wx")

expected_runtime=guesser.estimate("<put your query text here>")

Only problem is that the timemachine module is currently only installed
on Guidos and Tims Python.

Harald
Jul 19 '05 #4
Harald Massa wrote:
it's for wx, the problem isn't making the progress bar itself, it's
knowing how long the query is going to run for.
i'm using pypgsql


It is quite easy:

from timemachine import oracle

guesser=oracle(guess="SQL")
guesser.set_hint(driver="pypgsql")
guesser.set_hint(gui="wx")

expected_runtime=guesser.estimate("<put your query text here>")

Only problem is that the timemachine module is currently only installed
on Guidos and Tims Python.

Harald

man thats exactly what i'm looking for. it won't install on standard 2.3 ?
Jul 19 '05 #5
f
Timothy Smith wrote:
is it possible to mke a progress bar for queries? say i have a query
that will take 20 seconds, i'd like to give some feed back to users on
how long this will take.


it is strictly impossible to predict that cause of network load, server
load, query complexity ....

i recommend you put an activity widget, something moving (ie throbber in
wxPython) while waiting for the result (like the rotating circle in
firefox).

once query is finished stop your moving stuff, so the user knows it's
completed.

So you don't need a progress bar, but an activity widget. in gtk, i saw
that progress bar could be put in activity mode.

And don't forget to add a timeout ...

François
Jul 19 '05 #6
Timothy Smith wrote:
i'm using pypgsql


Assuming you work with PostgreSQL, then:
You know the EXPLAIN command?

EXPLAIN will give you a very accurate estimation for the expense for the
query.
(You'll have to find out what cost means in terms of your progress.)

I did never try this using pypgsql, but if it works, this might be your
solution...

The precision of EXPLAIN, however, depends on the modifications since the
last time you ran VACUUM on the DB.
If the size of tables or indices didn't suffer considerable changes since
then, the estimation should be quite accurate.

Bernhard

Jul 19 '05 #7
Bernhard Holzmayer wrote:
Timothy Smith wrote:
i'm using pypgsql


Assuming you work with PostgreSQL, then:
You know the EXPLAIN command?

EXPLAIN will give you a very accurate estimation for the expense for the
query.
(You'll have to find out what cost means in terms of your progress.)

I did never try this using pypgsql, but if it works, this might be your
solution...

The precision of EXPLAIN, however, depends on the modifications since the
last time you ran VACUUM on the DB.
If the size of tables or indices didn't suffer considerable changes since
then, the estimation should be quite accurate.

Bernhard


i've never heard of pypgsql supporting andthing like that, but i'll have
a look

Jul 19 '05 #8
f wrote:
Timothy Smith wrote:
is it possible to mke a progress bar for queries? say i have a query
that will take 20 seconds, i'd like to give some feed back to users on
how long this will take.
....an activity widget, something moving (ie throbber in wxPython)
while waiting for the result (like the rotating circle in firefox)....

The one extra thing you might want to do, if your application gets
regular use, is show elapsed time. The user will come to know how
long it should take, while your application probably won't get any
smarter.

--Scott David Daniels
Sc***********@Acm.Org
Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by greg | last post: by
2 posts views Thread by David Garamond | last post: by
reply views Thread by Lee Blevins | last post: by
6 posts views Thread by mattdaddym | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.