To create a new MySQL Shell global object to act as an entry
point for your extension objects, first create a new top-level
extension object using the built-in
shell.createExtensionObject() function in
Then register this top-level extension object as a MySQL Shell
global object by calling the
shell.register_global() in Python. The syntax
for the method is as follows:
shell.registerGlobal(name, object[, definition])
nameis a string giving the name (and class) of the global object. The name must be a valid scripting identifier, so the first character must be a letter or underscore character, followed by any number of letters, numbers, or underscore characters. The name must be unique in your MySQL Shell installation, so it must not be the name of a built-in MySQL Shell global object (for example,
util) and it must not be a name you have already used for a user-defined MySQL Shell global object. The examples below show how to check whether the name already exists before registering the global object.Important
ext). If you register the global object with a complex name in camel case or snake case (for example,
myCustomObject), when you use the global object, you must specify the name as it was registered. Only the names used for members are handled in a language-appropriate way.
objectis the extension object that you are registering as a MySQL Shell global object. You can only register an extension object once.
definitionis an optional dictionary with help information for the global object that is provided in the MySQL Shell help system. The dictionary contains the following keys:
brief(string, optional): A short description of the global object to be provided as help information.
details(list of strings, optional): A detailed description of the global object to be provided as help information.