Skip to content

Commit 65b446a

Browse files
committed
Add execution progress section to README
1 parent f0f7fb6 commit 65b446a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,34 @@ The `Store` class supports the following options:
9999
Use `Store.for_download()` as a convenient shorthand for storing results
100100
as a single Parquet file with a presigned URL.
101101

102+
### Execution progress
103+
104+
You can monitor the progress of running queries by registering a
105+
progress handler on the connection.
106+
107+
```python
108+
from wherobots.db import connect, ProgressInfo
109+
from wherobots.db.region import Region
110+
from wherobots.db.runtime import Runtime
111+
112+
def on_progress(info: ProgressInfo) -> None:
113+
print(f"{info.tasks_completed}/{info.tasks_total} tasks "
114+
f"({info.tasks_active} active)")
115+
116+
with connect(
117+
api_key='...',
118+
runtime=Runtime.TINY,
119+
region=Region.AWS_US_WEST_2) as conn:
120+
conn.set_progress_handler(on_progress)
121+
curr = conn.cursor()
122+
curr.execute("SELECT ...")
123+
results = curr.fetchall()
124+
```
125+
126+
The handler receives a `ProgressInfo` named tuple with `execution_id`,
127+
`tasks_total`, `tasks_completed`, and `tasks_active` fields. Pass
128+
`None` to `set_progress_handler()` to disable progress reporting.
129+
102130
### Runtime and region selection
103131

104132
You can chose the Wherobots runtime you want to use using the `runtime`

0 commit comments

Comments
 (0)