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

cli/sql: support for client-side \o #83118

Merged
merged 1 commit into from
Jun 23, 2022
Merged

Conversation

knz
Copy link
Contributor

@knz knz commented Jun 21, 2022

Release note (cli change): cockroach sql (and thus cockroach demo
too) now support the client-side commands \o and \qecho like
psql. The command \o can redirect the output of SQL queries to a
file. \qecho adds an arbitrary text to the current query output file.

@knz knz requested review from otan and a team June 21, 2022 10:48
@knz knz requested review from a team as code owners June 21, 2022 10:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. just had some testing comments

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @otan)


pkg/cli/interactive_tests/test_local_cmds.tcl line 272 at r1 (raw file):

send "\\o logs/query-output.txt\r"
eexpect root@
send "select 'hello world';\r"

does the output appear in the CLI as well (like tee)? if so, add a test for that

also, perhaps add a test to see how query syntax/execution errors are redirected to that file


pkg/cli/interactive_tests/test_local_cmds.tcl line 283 at r1 (raw file):

eexpect "hello"
eexpect root@
end_test

nit: test qecho as well

@knz knz force-pushed the 20220621-sql-o branch from a9cb297 to 476c1ba Compare June 21, 2022 21:20
Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan and @rafiss)


pkg/cli/interactive_tests/test_local_cmds.tcl line 272 at r1 (raw file):

does the output appear in the CLI as well (like tee)?

nope

also, perhaps add a test to see how query syntax/execution errors are redirected to that file

they're not (like in psql), but good point to test. Done.


pkg/cli/interactive_tests/test_local_cmds.tcl line 283 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

nit: test qecho as well

Good point. Done.

Release note (cli change): `cockroach sql` (and thus `cockroach demo`
too) now support the client-side commands `\o` and `\qecho` like
`psql`. The command `\o` can redirect the output of SQL queries to a
file. `\qecho` adds an arbitrary text to the current query output file.
@knz knz force-pushed the 20220621-sql-o branch from 476c1ba to df18c7f Compare June 21, 2022 21:26
@knz
Copy link
Contributor Author

knz commented Jun 22, 2022

RFAL

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

Reviewed 6 of 7 files at r1, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan and @rafiss)

@knz
Copy link
Contributor Author

knz commented Jun 23, 2022

thanks!

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Jun 23, 2022

Build failed:

@knz
Copy link
Contributor Author

knz commented Jun 23, 2022

unrelated flake

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Jun 23, 2022

Build succeeded:

@craig craig bot merged commit 558370b into cockroachdb:master Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants