from ext.mysqlsh_plugins_common import register_plugin from ext.user import create register_plugin("create", create.create_user, {"brief": "Wizard to create a user", "parameters": [{ "name": "verbose", "brief": "Show the generated create statement.", "type": "bool", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False } ] }, "user", { "brief": "Junior DBA Wizard to manage users.", "details": [ "A collection of wizards to manage users for junior DBAs" ] } )
from ext.innodb import fragmented from ext.innodb import progress from ext.innodb import bufferpool register_plugin( "getFragmentedTables", fragmented.get_fragmented_tables, { "brief": "Prints InnoDB fragmented tables", "parameters": [{ "name": "percent", "brief": "Amount of free space to be considered as fragmented", "type": "integer", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "innodb", { "brief": "InnoDB management and utilities.", "details": [ "A collection of InnoDB management tools and related " "utilities that work on InnoDB Engine" ] }) register_plugin( "getFragmentedTablesDisk", fragmented.get_fragmented_tables_disk, { "brief":
from ext.mysqlsh_plugins_common import register_plugin from ext.security import expire as security_expire from ext.security import authmethod as security_authmethod register_plugin( "showPasswordExpire", security_expire.show_password_expire, { "brief": "Lists all accounts and their expiration date", "parameters": [{ "name": "show_expire", "brief": "List expired passwords too", "type": "bool", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "security", { "brief": "Security management and utilities.", "details": ["A collection of security management tools and related " "utilities"] }) register_plugin( "showPasswordExpireSoon", security_expire.show_password_expire_soon, { "brief":
from ext.schema import defaults as schema_defaults from ext.schema import delproc as schema_delproc from ext.schema import dates as schema_dates register_plugin( "showProcedures", schema_src.show_procedures, { "brief": "Lists all stored procedures.", "parameters": [{ "name": "schema", "brief": "The schema which to list the stored procedures from.", "type": "string", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "schema", { "brief": "Schema management and utilities.", "details": [ "A collection of schema management tools and related " "utilities that work on schemas" ] }) register_plugin( "showDefaults", schema_defaults.show_defaults, { "brief":
from ext.mysqlsh_plugins_common import register_plugin from ext.check import trx from ext.check import queries register_plugin( "showTrxSize", trx.show_trx_size, { "brief": "Prints Transactions Size from a binlog", "parameters": [{ "name": "binlog", "brief": "The binlog file to extract transactions from.", "type": "string", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "check", { "brief": "Check management and utilities.", "details": ["A collection of Check management tools and utilities"] }) register_plugin( "showTrxSizeSort", trx.show_trx_size_sort, { "brief": "Prints Transactions Size from a binlog", "parameters": [{ "name": "limit",
# init.py # ------- from ext.mysqlsh_plugins_common import register_plugin from ext.connect import mycnf register_plugin( "mycnf", mycnf.connect_with_mycnf, { "brief": "Connect to MySQL using old .my.cnf file", "parameters": [{ "name": "mysqlx", "brief": "is the connection expected to use MySQL X Protocol ?", "type": "bool", "required": False }, { "name": "file", "brief": "specific my.cnf file locatation, default is ~/.my.cnf", "type": "string", "required": False }] }, "connect", { "brief": "Connect to MySQL", "details": ["Plugin to connect using the old my.cnf file"] })
# To define a function parameter as optional, set the 'required' option to False # when specifying the parameter. Optional parameters should be at the end of # the parameter list. try: shell.add_extension_object_member( plugin_obj, "showSchemas", show_schemas, { "brief": "Lists all database schemas.", "parameters": [{ "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }) except Exception as e: shell.log( "ERROR", "Failed to register ext.demo.showSchemas ({0}).".format( str(e).rstrip())) try: register_plugin("oracle8ball", oracle_8_ball.tell_me, { "brief": "Get the answer from the Oracle 8 Black Ball", "parameters": [] }, "demo") except Exception as e: shell.log( "ERROR", "Failed to register ext.demo.oracle8ball ({0}).".format( str(e).rstrip()))
register_plugin("fetchInfo", fetch.get_fetch_info, {"brief": "Fetch info from the system", "parameters": [{ "name": "mysql", "brief": "Fetch info from MySQL (enabled by default)", "type": "bool", "required": False },{ "name": "os", "brief": "Fetch info from Operating System (requires to have the Shell running locally)" "This is disabled by default", "type": "bool", "required": False },{ "name": "advices", "brief": "Print eventual advices. This is disabled by default", "type": "bool", "required": False },{ "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False } ] }, "support", { "brief": "Getting Information useful for requesting help.", "details": [ "A collection of methods useful when requesting help such as support " "or Community Slack and Forums" ] } )
from ext.mysqlsh_plugins_common import register_plugin from ext.innodb_cluster import secondary register_plugin( "showGroupReplicationSpeed", secondary.show_speed, { "brief": "Prints replication information speed information", "parameters": [{ "name": "limit", "brief": "For how many seconds the output show be displayed, refreshed every second and default is 10", "type": "integer", "required": False }, { "name": "session", "brief": "The session to be used on the operation. This must be a session to a InnoB Cluster member", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "innodb_cluster", { "brief": "MySQL InnoDB Cluster management and utilities.", "details": [ "A collection of MySQL InnoDB Cluster management tools and utilities" ] })
from ext.mysqlsh_plugins_common import register_plugin from ext.audit import trx register_plugin("showTrxSize", trx.show_trx_size, {"brief": "Prints Transactions Size from a binlog", "parameters": [{ "name": "binlog", "brief": "The binlog file to extract transactions from.", "type": "string", "required": False },{ "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False } ] }, "audit", { "brief": "Audit management and utilities.", "details": [ "A collection of Audit management tools and utilities" ] } ) register_plugin("showTrxSizeSort", trx.show_trx_size_sort, {"brief": "Prints Transactions Size from a binlog", "parameters": [{
from ext.innodb import progress from ext.innodb import bufferpool from ext.innodb import autoinc register_plugin( "getFragmentedTables", fragmented.get_fragmented_tables, { "brief": "Prints InnoDB fragmented tables", "parameters": [{ "name": "percent", "brief": "Amount of free space to be considered as fragmented", "type": "integer", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "innodb", { "brief": "InnoDB management and utilities.", "details": [ "A collection of InnoDB management tools and related " "utilities that work on InnoDB Engine" ] }) register_plugin( "getFragmentedTablesDisk", fragmented.get_fragmented_tables_disk, { "brief":
register_plugin( "nonUnique", check_src.non_unique, { "brief": "Find non-unique values in a column for a given collation", "parameters": [{ "name": "table", "brief": "Table name to use.", "type": "string", "required": True }, { "name": "column", "brief": "column to check.", "type": "string", "required": True }, { "name": "collation", "brief": "collation to check.", "type": "string", "required": True }, { "name": "schema", "brief": "Schema to use.", "type": "string", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "collations", { "brief": "Collation utilities.", "details": ["A collection of collation utilites"] })
# This plugin will define the following functions # - ext.schema.showProcedures([schema], [session]) from ext.mysqlsh_plugins_common import register_plugin from ext.schema import src as schema_src register_plugin( "showProcedures", schema_src.show_procedures, { "brief": "Lists all stored procedures.", "parameters": [{ "name": "schema", "brief": "The schema which to list the stored procedures from.", "type": "string", "required": False }, { "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "schema", { "brief": "Schema management and utilities.", "details": [ "A collection of schema management tools and related " "utilities that work on schemas" ] })
from ext.mysqlsh_plugins_common import register_plugin from ext.maintenance import shutdown register_plugin( "shutdown", shutdown.shutdown, { "brief": "Stop the instance using Std Protocol", "parameters": [{ "name": "session", "brief": "The session to be used on the operation.", "type": "object", "classes": ["Session", "ClassicSession"], "required": False }] }, "maintenance", { "brief": "Server management and utilities.", "details": ["A collection of Server management tools and utilities"] })