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: support -f to read SQL from a file #54741

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Conversation

knz
Copy link
Contributor

@knz knz commented Sep 24, 2020

Fixes #42955

Release note (cli change): cockroach sql and cockroach demo now
support the command-line parameter --input-file (shorthand -f) to
read commands from a named file. The behavior is the same as if the
file was redirected on the standard input; in particular, the
processing stops at the first error encountered (which is different
from interactive usage with a prompt).

Note that it is not (yet) possible to combine -f with -e.

This makes it easier to process a file other than the standard input.

Release note: None
@knz knz requested a review from irfansharif September 24, 2020 11:03
@knz knz requested a review from a team as a code owner September 24, 2020 11:03
@cockroach-teamcity
Copy link
Member

This change is Reviewable

results of each SQL statement are printed on the standard output.`,
results of each SQL statement are printed on the standard output.

This flag is incompatible with --input-file / -f.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have an alternative, but is input-file used in other CLIs? The -f feels familiar+intuitive, the --input-file doesn't as much (partly because it doesn't start with an f).

@knz
Copy link
Contributor Author

knz commented Sep 24, 2020

psql uses --file as longhand. I'll change the code to that.

Release note (cli change): `cockroach sql` and `cockroach demo` now
support the command-line parameter `--input-file` (shorthand `-f`) to
read commands from a named file. The behavior is the same as if the
file was redirected on the standard input; in particular, the
processing stops at the first error encountered (which is different
from interactive usage with a prompt).

Note that it is not (yet) possible to combine `-f` with `-e`.
@knz
Copy link
Contributor Author

knz commented Sep 24, 2020

bors r=irfansharif

@craig
Copy link
Contributor

craig bot commented Sep 24, 2020

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Sep 24, 2020

Build succeeded:

@craig craig bot merged commit b6aa84a into cockroachdb:master Sep 24, 2020
craig bot pushed a commit that referenced this pull request Sep 24, 2020
54261: ui: add transactions page to Admin UI r=dhartunian a=elkmaster

This commit adds the new Transactions Page to the Admin UI.

This page is much like the Statements Page but differs in that
it shows Transaction-level statistics in tabular and detail form.

Every Transaction is able to display its contained Statements
for more detailed analysis.

The page and its components are imported from the
`admin-ui-components` library.

Depends on: cockroachdb/yarn-vendored#38

Release justification: low-risk high impact addition to Admin UI

Release note (admin ui change): add Transactions and Transactions
details pages. These pages allow for viewing stats at the
transaction level.

54749: cli/demo: provision an initial non-`root` "demo" user  r=irfansharif a=knz

Fixes #54557.
Requested by @jseldess 

First 2 commits from   #54741 (can be ignored during review)

Release note (cli change): `cockroach demo` now pre-creates a `demo`
user account with a random password, instead of letting (and
encouraging) the user to use the `root` account directly.
The `demo` account is currently granted the `admin` role.

54755: sql: fix bug whereby backfiller would drop spans on txn restart r=ajwerner a=ajwerner

This bug was caught by testing with #54695. Before that change, it would fail
almost immediately, now it does not fail under stress. I'm open to suggestions
on how to more generally test this.

Release note (bug fix): Fixed a rare bug which can lead to index backfills
failing in the face of transaction restarts.

Co-authored-by: Vlad <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
Co-authored-by: Andrew Werner <[email protected]>
@knz knz deleted the 20200924-cli-f branch September 25, 2020 07:56
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.

cli:cockroach sql command should have -f option to pass sql file
3 participants