-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cli: adds \d, \dt, \du, \l metacommands to sql shell #39141
Conversation
6c37c61
to
255b83a
Compare
lint errors, running again locally |
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.
Generally ! A couple of small comments within.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis and @kenliu)
pkg/cli/sql.go, line 48 at r1 (raw file):
# Welcome to the CockroachDB SQL shell. # All statements must be terminated by a semicolon. # To exit, type: \q.
Maybe To exit, CTRL + D or type \q.
? (ctrl+d still works, after all.)
pkg/cli/sql.go, line 1040 at r1 (raw file):
case `\d`: if len(cmd) > 1 {
Seems like we might want to make this == 1
? Otherwise, you could type \d foo bar
and it would give you columns from foo
and ignore the second parameter completely.
@jordanlewis I got this lint error, not sure how to resolve |
It's saying that the
It wants it to become:
|
(Or vice versa, which IMO might look cleaner, but doesn't really matter) |
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis and @knz)
pkg/cli/sql.go, line 48 at r1 (raw file):
Previously, jordanlewis (Jordan Lewis) wrote…
Maybe
To exit, CTRL + D or type \q.
? (ctrl+d still works, after all.)
It turns out that CTRL-D doesn't work on Windows (I tried it) and our help message shows \q as the primary command to exit. There are many others (and it turns out there are undocumented ones) so I thought it best to show just the one here and if someone wants to look for the others they'll figure it out.
pkg/cli/sql.go, line 1040 at r1 (raw file):
Previously, jordanlewis (Jordan Lewis) wrote…
Seems like we might want to make this
== 1
? Otherwise, you could type\d foo bar
and it would give you columns fromfoo
and ignore the second parameter completely.
good call
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.
LGTM but I stand behind jordan's request on if len(cmd) == 1
for the \d case
Reviewed 3 of 3 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)
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.
addressed comments. added an additional test to catch this case too.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @jordanlewis and @knz)
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.
also fixed lint error
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @jordanlewis and @knz)
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.
Nice tests, too! - please make sure to squash your commits before merging. (as a side note, avoiding this final squash step is why I like to keep amending PRs rather than pushing small new commits :)
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @knz)
makes sense, although isn't it easier for the reviewer to see the delta between the last review and and the set of review fixes? Could always squash at the very end. |
c8a5966
to
358e333
Compare
- adds support for `\l`, `\dt`, `\du`, and ‘\d <table>` - tweak welcome message for consistency - fix welcome message to show `\q` instead of `CTRL + D` since that doesn’t work on Windows, and isn’t the primary documented way to quit from the shell Release note: added \d, \dt, \du, \l metacommands to cli shell
358e333
to
8fa961c
Compare
This problem is why we use the Reviewable tool, which does a decent job of showing you the delta between the last review and the set of review fixes, even if you amend your commit. (It lets you view a diff between 2 versions of the same commit.) |
ohh I see, makes sense. |
bors r+ |
39141: cli: adds \d, \dt, \du, \l metacommands to sql shell r=kenliu a=kenliu Also tweaked shell welcome message to mention “\q” instead of “CTRL + D” (doesn’t work on Windows, and isn’t primary command) Release note: added \d, \dt, \du, \l metacommands to cli shell Co-authored-by: Kenneth Liu <ken@cockroachlabs.com>
Build succeeded |
@kenliu nit for next time: the release note generation program wants to know the category of the release note, so instead of this
you can do this:
and it's also good to add some explanatory context for users, to motivate the change, for example:
|
Sounds good, thanks. Is there documentation to explain how the release note process works? I didn't really have any idea if these notes were doing to be user facing or if the docs team was going to edit them further. |
The particular section on release notes is here: https://wiki.crdb.io/wiki/spaces/CRDB/pages/73072807/Git+Commit+Messages#GitCommitMessages-Releasenotes
|
Note that even though the doc team edits them further, they are very much appreciative of text that gives them enough context to understand what's going on. |
Got it, thanks!
On Fri, Aug 9, 2019 at 11:07 AM kena ***@***.***> wrote:
Note that even though the doc teams edits them further, they are very much
appreciative of text that gives them enough context to understand what's
going on.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#39141?email_source=notifications&email_token=AAALRAXPOYJK3SDAVD7MC3DQDWB3BA5CNFSM4IHLQTH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD366DOQ#issuecomment-519954874>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAALRAVLIYMJBZ563UQXLHLQDWB3BANCNFSM4IHLQTHQ>
.
--
Ken Liu | Engineering Manager
*Cockroach Labs*
*Help us Make Data Easy!* <http://grnh.se/l4bqjc>
|
Also tweaked shell welcome message to mention “\q” instead of “CTRL + D” (doesn’t work on Windows, and isn’t primary command)
Release note: added \d, \dt, \du, \l metacommands to cli shell