MySQL Shell 8.0.16 – What’s New?

The MySQL Development team is proud to announce a new version of the MySQL Shell which includes the following features:

  • Addition of a reporting framework:
    • API to register custom reports.
    • Shell command to display a specific report (\show).
    • Shell command to monitor a specific report (\watch).
  • The \sql shell command now allows executing SQL statements even while in JavaScript or Python mode.

The following enhancements were also introduced:

  • Command history is now separated by shell mode (SQL/JavaScript/Python).
  • Improved printing of SQL results in JSON format.
  • Improved InnoDB Cluster support by enhancing the Admin API as follows:
    • Adding options to define the number of rejoining attempts allowed for expelled members.
    • Improving the content of the cluster status output to include MySQL version of members.
    • Support automatic handling of Group Replication protocol versions
  • Improved the Upgrade Checker utility with the addition of checks for variables on the configuration files.

Shell Reporting Framework

Monitoring is one of the main activities of a DBA and having the ability to define custom reports is one of the main tools to achieve it. On this release a couple of shell commands have been added to enable monitoring through the usage of user-defined reports:

  • The \show shell command enables displaying a previously registered report.
  • The \watch shell command enables displaying a report using a refresh interval.

A shell report is defined as a function that receives a session and some arguments and options. This function is registered into the shell reporting framework through the following function:

Once this report_function is registered, the report is made available through the \show and \watch shell commands and can be invoked despite the active shell mode:

For more information about this topic look at the Reporting section of the MySQL Shell User Guide.

Executing SQL in JavaScript and Python modes

The \sql shell command has been used to switch to SQL mode and allow direct execution of SQL statements using the global session.

On this release, it’s behavior has been improved to receive an optional parameter which is processed as an SQL statement. When the SQL statement is provided, no switch to the SQL mode will be performed, instead, the SQL statement will be executed using the global session and its result will be displayed right away.

When the \sql shell command is executed without any additional parameter, it will switch to SQL mode as before.

Result Printing Improvements

When querying Document Store Collection results were printed as a single JSON document containing:

  • Statistics
  • Warning Information
  • The returned JSON Documents

This has been properly integrated in a way that warnings and statistics are now handled following the same standards as for table results.

Each returned document from a collection is now printed as a separate JSON Document.

Resources

For details about the MySQL Shell please take a look at the MySQL Shell User Guide.

For additional details about features introduced by this version and the full list of fixed bugs take a look at the Release Notes.

Specific details about the changes in InnoDB Cluster Support can be found at the MySQL InnoDB Cluster – What’s new in the 8.0.16 release blog post.

Don’t forget to download it and give it a try, your feedback is very welcome!

You can reach us at #shell channel in https://mysqlcommunity.slack.com/

About Rene Ramirez

Juan Rene Ramirez Monarrez (a.k.a. rennox) is a Software Engineer with a master degree in Computer Science residing in Mexico. He started his career at IBM almost 20 years ago in application development, had a pass on Automation at Freescale Semiconductor (now MXP) and landed at the MySQL world 8 years ago. At MySQL he started working at the Workbench team and now is leading the efforts to make the MySQL Shell the client by excellence for different MySQL products.