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

gh-77617: Add interactive shell for sqlite3 #95026

Merged
merged 37 commits into from Aug 1, 2022

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Jul 19, 2022

Disclaimer: this is based off of an old proof-of-concept branch I had lying around. Take it as it is :)

Resolves gh-77617

TODO:

  • docs
  • tests?

Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
@erlend-aasland erlend-aasland marked this pull request as ready for review Jul 20, 2022
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 29, 2022

@rhettinger, would you mind reviewing this?

@erlend-aasland erlend-aasland marked this pull request as draft Jul 29, 2022
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 29, 2022

Putting this PR on hold until the --enable-loadable-sqlite-extensions mess has been fixed in main.

@erlend-aasland erlend-aasland marked this pull request as ready for review Jul 29, 2022
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
erlend-aasland and others added 4 commits Jul 29, 2022
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 31, 2022

The python3 -m sqlite3 :memory: "pragma compile_options" trick will be very helpful for triaging and debugging issues.

Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Lib/sqlite3/__main__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

LGTM

@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Jul 31, 2022

Added tests; plus some adjustments:

  • return non-zero if SQL passed from the command line fails
  • print exceptions to stderr (not sure if this is a good idea; I have no strong opinion here)

PTAL, @serhiy-storchaka and @kumaraditya303

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

👍

Lib/test/test_sqlite3/test_cli.py Show resolved Hide resolved
Lib/test/test_sqlite3/test_cli.py Outdated Show resolved Hide resolved
@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Aug 1, 2022

Thank you for the helpful reviews, Dong-hee, Kumar, and Serhiy. Highly appreciated!

@erlend-aasland
Copy link
Contributor Author

@erlend-aasland erlend-aasland commented Aug 1, 2022

FTR, I'm going to land this later today.

@erlend-aasland erlend-aasland merged commit bc7c7cd into python:main Aug 1, 2022
14 checks passed
@erlend-aasland erlend-aasland deleted the sqlite-shell branch Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib type-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants