Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query execution row and time limits #520

Open
rogerbinns opened this issue May 19, 2024 · 1 comment
Open

query execution row and time limits #520

rogerbinns opened this issue May 19, 2024 · 1 comment

Comments

@rogerbinns
Copy link
Owner

rogerbinns commented May 19, 2024

It would be nice to execute a query with row count and time limits. Row count is straight forward with an iterator wrapper.

For time limits it may be possible by doing something like:

  • set a progress handler
  • set a deadline in a context var in execute call
  • in the progress handler, check to see if the deadline has been hit
  • in a nested query, the deadline is whichever is sooner, the outside deadline or the inside deadline

I would be wise to implement #502 for the progress handler so multiple can co-exist.

Getting a monotonic clock is platform dependent. For python 3.13 there is an official API. For earlier releases the function py_get_monotonic_clock in the Python source Python/pytime.c has per platform headers and platform calls.

@rogerbinns
Copy link
Owner Author

This can be very hairy. For example the cursor iterator could be passed to another thread which would lose the context variable context.

The number of SQLite vm steps also matters in the progress callback since we want maybe tenth of a second granularity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant