diff options
author | Kevin Schmeichel <kevin.schmeichel@altres.com> | 2022-06-14 15:14:14 -1000 |
---|---|---|
committer | Kevin Schmeichel <kevin.schmeichel@altres.com> | 2022-06-14 15:14:14 -1000 |
commit | 26d8c7a515469b54317a7208807895a2d2c1675e (patch) | |
tree | b48e7fc3fd75d39c2b7653172e3522c458cf5ea9 | |
parent | eb4f08490bc6d7263a612f920a2329a7920d73c8 (diff) |
Fix the status command to work with missing 'Flush_commands' (mariadb)
-rw-r--r-- | mycli/packages/special/dbcommands.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mycli/packages/special/dbcommands.py b/mycli/packages/special/dbcommands.py index 45d7069..5c29c55 100644 --- a/mycli/packages/special/dbcommands.py +++ b/mycli/packages/special/dbcommands.py @@ -34,6 +34,7 @@ def list_tables(cur, arg=None, arg_type=PARSED_QUERY, verbose=False): return [(None, tables, headers, status)] + @special_command('\\l', '\\l', 'List databases.', arg_type=RAW_QUERY, case_sensitive=True) def list_databases(cur, **_): query = 'SHOW DATABASES' @@ -45,6 +46,7 @@ def list_databases(cur, **_): else: return [(None, None, None, '')] + @special_command('status', '\\s', 'Get status information from the server.', arg_type=RAW_QUERY, aliases=('\\s', ), case_sensitive=True) def status(cur, **_): @@ -146,7 +148,8 @@ def status(cur, **_): 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'])) + if 'Flush_commands' in status: + 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']) |