Documentation Home
MySQL Shell for VS Code


Pre-General Availability: 2024-03-18

5.8 ShellAPI

ShellAPI contains information about the shell and util global objects as well as the mysql module that enables executing SQL on MySQL Servers.

ShellAPI is available in JavaScript and Python.

The following Python objects are available:

Python Object Description
shell Provides access to general purpose functions and properties.
util Provides a global object that groups miscellaneous tools such as checkForServerUpgrade, to check if the upgrade process will be successful, or importJson, to import JSON documents from file to collection or table in MySQL Server using X Protocol session. For more information, see MySQL Shell Utilities.

The following classes are available in JavaScript and Python:

Class Description
Column Represents the metadata for a column in a result.
Row Represents the a row in a result.

The following JavaScript objects are available:

JavaScript Object Description
os Provides access to functions which allow you to interact with the operating system.
shell Provides access to general purpose functions and properties.
sys Provides access to system specific parameters. For more information, see Module Search Path Variable in Startup Scripts.
util Provides a global object that groups miscellaneous tools such as checkForServerUpgrade, to check if the upgrade process will be successful, or importJson, to import JSON documents from file to collection or table in MySQL Server using X Protocol session. For more information, see MySQL Shell Utilities.

The following JavaScript functions are available:

JavaScript Function Description
dir(object) Returns a list of enumerable properties on the target object.
require(module_name_or_path) Loads the specified JavaScript module.