Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TBD:
Bug Fixes:
---------
* Fix autocompletion for more than one JOIN
* Fix the status command when connected to TiDB or other servers that don't implement 'Threads\_connected'

1.24.1:
=======
Expand Down
36 changes: 19 additions & 17 deletions mycli/packages/special/dbcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,25 @@ def status(cur, **_):
else:
output.append(('UNIX socket:', variables['socket']))

output.append(('Uptime:', format_uptime(status['Uptime'])))

# Print the current server statistics.
stats = []
stats.append('Connections: {0}'.format(status['Threads_connected']))
if 'Queries' in status:
stats.append('Queries: {0}'.format(status['Queries']))
stats.append('Slow queries: {0}'.format(status['Slow_queries']))
stats.append('Opens: {0}'.format(status['Opened_tables']))
stats.append('Flush tables: {0}'.format(status['Flush_commands']))
stats.append('Open tables: {0}'.format(status['Open_tables']))
if 'Queries' in status:
queries_per_second = int(status['Queries']) / int(status['Uptime'])
stats.append('Queries per second avg: {:.3f}'.format(
queries_per_second))
stats = ' '.join(stats)
footer.append('\n' + stats)
if 'Uptime' in status:
output.append(('Uptime:', format_uptime(status['Uptime'])))

if 'Threads_connected' in status:
# Print the current server statistics.
stats = []
stats.append('Connections: {0}'.format(status['Threads_connected']))
if 'Queries' in status:
stats.append('Queries: {0}'.format(status['Queries']))
stats.append('Slow queries: {0}'.format(status['Slow_queries']))
stats.append('Opens: {0}'.format(status['Opened_tables']))
stats.append('Flush tables: {0}'.format(status['Flush_commands']))
stats.append('Open tables: {0}'.format(status['Open_tables']))
if 'Queries' in status:
queries_per_second = int(status['Queries']) / int(status['Uptime'])
stats.append('Queries per second avg: {:.3f}'.format(
queries_per_second))
stats = ' '.join(stats)
footer.append('\n' + stats)

footer.append('--------------')
return [('\n'.join(title), output, '', '\n'.join(footer))]