Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:20 AM
Timothy Smith
Guest
 
Posts: n/a
Default 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.
  #2  
Old July 19th, 2005, 02:20 AM
ryan@ryankaskel.com
Guest
 
Posts: n/a
Default Re: query progress bar

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>

  #3  
Old July 19th, 2005, 02:20 AM
Timothy Smith
Guest
 
Posts: n/a
Default Re: query progress bar

ryan@ryankaskel.com wrote:
[color=blue]
>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>
>
>
>[/color]
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
  #4  
Old July 19th, 2005, 02:21 AM
Harald Massa
Guest
 
Posts: n/a
Default Re: query progress bar

> it's for wx, the problem isn't making the progress bar itself, it's[color=blue]
> knowing how long the query is going to run for.
> i'm using pypgsql[/color]

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
  #5  
Old July 19th, 2005, 02:21 AM
Timothy Smith
Guest
 
Posts: n/a
Default Re: query progress bar

Harald Massa wrote:
[color=blue][color=green]
>>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
>>
>>[/color]
>
>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
>
>[/color]
man thats exactly what i'm looking for. it won't install on standard 2.3 ?
  #6  
Old July 19th, 2005, 02:21 AM
f
Guest
 
Posts: n/a
Default Re: query progress bar

Timothy Smith wrote:[color=blue]
> 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.[/color]

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
  #7  
Old July 19th, 2005, 02:21 AM
Bernhard Holzmayer
Guest
 
Posts: n/a
Default Re: query progress bar

Timothy Smith wrote:
[color=blue]
> i'm using pypgsql[/color]

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

  #8  
Old July 19th, 2005, 02:21 AM
Timothy Smith
Guest
 
Posts: n/a
Default Re: query progress bar

Bernhard Holzmayer wrote:
[color=blue]
>Timothy Smith wrote:
>
>
>[color=green]
>>i'm using pypgsql
>>
>>[/color]
>
>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
>
>
>[/color]

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

  #9  
Old July 19th, 2005, 02:22 AM
Scott David Daniels
Guest
 
Posts: n/a
Default Re: query progress bar

f wrote:[color=blue]
> Timothy Smith wrote:
>[color=green]
>> 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.[/color][/color]
[color=blue]
> ....an activity widget, something moving (ie throbber in wxPython)
> while waiting for the result (like the rotating circle in firefox)....[/color]
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
Scott.Daniels@Acm.Org
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles