Skip to content

Extend status command output#1868

Merged
rolandwalker merged 1 commit intomainfrom
RW/extend-and-align-status-output
Apr 27, 2026
Merged

Extend status command output#1868
rolandwalker merged 1 commit intomainfrom
RW/extend-and-align-status-output

Conversation

@rolandwalker
Copy link
Copy Markdown
Contributor

Description

  • recast variables as global_variables
  • add session_variables dict
  • tighten legacy-server decoding logic
  • derive charset rows from session_variables instead of a new query
  • add "Using delimiter" row, matching the vendor client
  • add "Using outfile" row (tee target), matching the vendor client
  • add SSL cipher row, matching the vendor client
  • add "Result characterset" row, an extension beyond the vendor client
  • add "Server timezone" row, an extension
  • add "Local timezone" row, an extension
  • align charset key names
  • make more None/null values the empty string, for consistency and to match the vendor client
  • add header so that status\G doesn't crash within cli_helpers
  • tweak some commentary

The vendor client also shows the setting for how binary data is rendered, which seems more difficult for mycli to include.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker force-pushed the RW/extend-and-align-status-output branch from a925d02 to 1c9c280 Compare April 27, 2026 09:31
output.append(("Db characterset:", charset[1]))
output.append(("Client characterset:", charset[2]))
output.append(("Conn. characterset:", charset[3]))
charset_spec = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we let the cli_helpers render format these instead of forcing a format?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't quite understand. It does get formatted into a table by cli_helpers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean the spacing like Db characterset:, adding the spaces in between. But if that is the only way to get the alignment you want then that works.

Comment thread mycli/packages/special/dbcommands.py Outdated
output.append(("Server version:", f'{variables["version"]} {variables["version_comment"]}'))
output.append(("Protocol version:", variables["protocol_version"]))
output.append(('SSL/TLS version:', get_ssl_version(cur)))
output.append(("Using delimiter:", iocommands.delimiter_command.current))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this use get_current_delimiter() from iocommands instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Better!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Original suggestion was to use iocommands.get_current_delimiter() possibly instead of iocommands.delimiter_command.current since that function exists to get the value instead of directly accessing the property

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes! I made the change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rolandwalker Hah sorry, was looking at my own comment thinking it would be updated for some reason. Still too early I guess :p

Comment thread changelog.md Outdated

Features
---------
* Add more output to the `status` commnad.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

commnad = command

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oof, thanks

 * recast "variables" as "global_variables"
 * add "session_variables" dict
 * tighten legacy-server decoding logic
 * derive charset rows from "session_variables" instead of a new query
 * add "Using delimiter" row, matching the vendor client
 * add "Using outfile" row (tee target), matching the vendor client
 * add SSL cipher row, matching the vendor client
 * add "Result characterset" row, an extension beyond the vendor client
 * add "Server timezone" row, an extension
 * add "Local timezone" row, an extension
 * align charset key names
 * make more None/null values the empty string, for consistency and to
   match the vendor client
 * add header so that "status\G" doesn't crash within cli_helpers
 * tweak some commentary

The vendor client also shows the setting for how binary data is
rendered, which seems more difficult for mycli to include.
@rolandwalker rolandwalker force-pushed the RW/extend-and-align-status-output branch from 1c9c280 to 0d23663 Compare April 27, 2026 15:25
@rolandwalker rolandwalker merged commit f37f737 into main Apr 27, 2026
13 of 14 checks passed
@rolandwalker rolandwalker deleted the RW/extend-and-align-status-output branch April 27, 2026 16:04
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.

2 participants