-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Support completion for sqlite3 command-line interface #133390
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
Comments
I would disagree, this would presumably require quite a lot of work to implement and then maintain. Maybe this should be discussion on discourse first? |
Right. But I think for the moment we can support basic completion which takes not much work but gives big experience enhancement. |
#133393 introduces keyword expansion, but what about name expansion (the part I was originally worried about)? |
Can we get the name list when connecting to a disk-file database, merge it with keyword list as completion candidates? Also the name list need to be updated on deletion/creation of table/column. import sqlite3
def get_names(db_path):
ret = []
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;")
tables = [row[0] for row in cursor.fetchall()] # get table names
ret.extend(tables)
for table in tables:
cursor.execute(f"PRAGMA table_info({table})")
ret.extend(row[1] for row in cursor.fetchall()) # get column names
conn.close()
return ret
db_path = '/path/to/db.db'
list_of_names = get_names(db_path) |
@hugovk (BDFC ;-) out of curiosity, is this on your list for colorising, it is a good candidate ? I’d take a stab at it once this is merged. |
It's not on my list but sounds like a good candidate. See also #133247 that added syntax highlighting in the REPL and tools like https://github.com/dbcli/litecli. |
Opened #133447 :-) |
Feature or enhancement
Proposal:
Current
sqlite3
CLI lacks tab-completion feature. Hope it can be supported to improve usability.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: