gh-158277: sqlite3 CLI completer: include views in column completion - #158278
Open
Tony123-tech wants to merge 2 commits into
Open
Tony123-tech wants to merge 2 commits into
Tony123-tech wants to merge 2 commits into
Conversation
tanloong
reviewed
Sep 27, 2026
| def test_complete_view_columns(self): | ||
| input_ = textwrap.dedent("""\ | ||
| CREATE TABLE _table (_col_table); | ||
| CREATE VIEW _view AS SELECT _col_view AS _col_view_alias, |
Contributor
There was a problem hiding this comment.
Need to remove the _col_view AS _col_view_alias, as _table does not contain the _col_view column.
| @unittest.skipIf(sqlite3.sqlite_version_info < (3, 30, 0), | ||
| "PRAGMA function_list is not available until " | ||
| "SQLite 3.30.0") | ||
| def test_complete_view_columns(self): |
Contributor
There was a problem hiding this comment.
test_complete_view_columns() appears to have taken over the decorator intended for test_complete_functions(). Would it be better to put this test into the existing test_complete_columns()? That keeps the functionality tests together.
Contributor
Author
|
Thanks for the review! I've fixed both issues:
|
Contributor
CREATE TABLE _table (_col_table);
CREATE VIEW _view AS SELECT _col_table AS _col_table_alias FROM _table;
def test_complete_columns(self):
input_ = textwrap.dedent("""\
CREATE TABLE _table (_col_table);
CREATE TEMP TABLE _temp_table (_col_temp);
+ CREATE VIEW _view AS SELECT _col_table AS _col_table_alias FROM _table;
ATTACH ':memory:' AS attached;
CREATE TABLE attached._attached_table (_col_attached);
SELECT _col_\t\tta\tFROM _table;
.quit\n""").encode()
output = self.write_input(input_)
lines = output.decode().splitlines()
indices = [
i for i, line in enumerate(lines) if line.startswith(self.PS1)
]
start, end = indices[-3], indices[-2]
candidates = [l.strip() for l in lines[start+1:end]]
self.assertEqual(
- candidates, ["_col_attached", "_col_table", "_col_temp"]
+ candidates, ["_col_attached", "_col_table", "_col_table_alias", "_col_temp"]
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes gh-158277.