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

Make SQLite queries cancellable #7351

Merged
merged 3 commits into from
Dec 5, 2022
Merged

Conversation

rgwood
Copy link
Contributor

@rgwood rgwood commented Dec 4, 2022

This change makes SQLite queries (open foo.db, open foo.db | query db "select ...") cancellable using ctrl+c. Previously they were not cancellable, which made it unpleasant to accidentally open a very large database or run an unexpectedly slow query!

UX-wise there's not too much to show:

image

Notes

I was hoping to make SQLite queries streamable as part of this work, but I ran into 2 problems:

  1. rusqlite lifetimes are nightmarishly complex and they make it hard to create a ListStream iterator
  2. The functions on Nu's CustomValue trait return Value not PipelineData and so CustomValue implementations can't stream data AFAICT.

@rgwood rgwood added the signal-cancel Problems with how executions react to signals or attempts at cancellation (CTRL-C) label Dec 4, 2022
@fdncred
Copy link
Collaborator

fdncred commented Dec 4, 2022

I think being able to ctrl-c is a massive step in the right direction. I've been caught too many times in a massive db (crates.io db) or a "oh crap, i just ran the wrong query". Good work @rgwood!!

@rgwood rgwood merged commit 57ff668 into nushell:main Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
signal-cancel Problems with how executions react to signals or attempts at cancellation (CTRL-C)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants