示例#1
0
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"
             ]
           }
     )
示例#2
0
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":
示例#3
0
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":
示例#4
0
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":
示例#5
0
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",
示例#6
0
# 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"]
    })
示例#7
0
# 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()))
示例#8
0
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"
             ]
           }
     )
示例#9
0
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"
        ]
    })
示例#10
0
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": [{
示例#11
0
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":
示例#12
0
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"]
    })
示例#13
0
# 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"
        ]
    })
示例#14
0
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"]
    })