-
Notifications
You must be signed in to change notification settings - Fork 84
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
Return indexes when .schema is run #219
Conversation
@@ -20,6 +20,8 @@ | |||
except ImportError: | |||
llm = None | |||
cli = None | |||
LLM_CLI_COMMANDS = [] | |||
MODELS = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without these my tests were breaking.
WHERE type = 'index' AND tbl_name LIKE ? AND name NOT LIKE 'sqlite_%' | ||
ORDER BY 1 | ||
""" | ||
else: | ||
args = tuple() | ||
query = """ | ||
SELECT name FROM sqlite_master | ||
SELECT name, sql FROM sqlite_master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an option to return SQL of the index. This is breaking change.
|
||
return [(None, tables, headers, status)] + _list_indexes(cur, arg=arg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per my understanding, l1 + l2
or l1.extend(l2)
or [*l1, l2]` have similar performance hence used the most intutive one.
@kracekumar I see that The implementation in this PR shows the indices twice when we run I believe what we need is to change these lines to this query:
That should do what we want. Thoughts? |
That's a good call and consistent. I have updated the code to use |
Very nice! Thank you for the quick turnaround. 🥂 |
Description
.schema
command doesnot return index associated with the table..schema
command returns so..index
command is run only name was returned, now both name and SQL is returned that is similar to sqliteExamples
Checklist
CHANGELOG.md
file.