MySQL Shell 9.3
MySQL Shell includes a number of built-in global objects that exist in both JavaScript and Python modes. The built-in MySQL Shell global objects are as follows:
session
is available when a global session
is established, and represents the global session.
dba
provides access to InnoDB Cluster,
InnoDB ClusterSet, and InnoDB ReplicaSet administration
functions using the AdminAPI. See
Chapter 6, MySQL AdminAPI.
cluster
represents an InnoDB Cluster.
Only populated if the
--cluster
option was provided
when MySQL Shell was started.
rs
represents an InnoDB ReplicaSet. Only
populated if the --replicaset
option was provided when MySQL Shell was started.
db
is available when the global session was
established using an X Protocol connection with a default
database specified, and represents that schema.
shell
provides access to various
MySQL Shell functions, for example:
shell.options
provides functions to set
and unset MySQL Shell preferences. See
Section 14.4, “Configuring MySQL Shell Options”.
shell.reports
provides built-in or
user-defined MySQL Shell reports as functions, with the
name of the report as the function. See
Section 11.1, “Reporting with MySQL Shell”.
util
provides various MySQL Shell tools,
including the upgrade checker utility, the JSON import
utility, and the parallel table import utility. See
Chapter 12, MySQL Shell Utilities.
The names of the MySQL Shell global objects are reserved as global variables and must not be used, for example, as names of variables. If you assign one of the global variables you override the above functionality, and to restore it you must restart MySQL Shell.
You can also create your own extension objects and register them as additional MySQL Shell global objects to make them available in a global context. For instructions to do this, see Section 11.2, “Adding Extension Objects to MySQL Shell”.